Mysql 在存储过程的另一个语句中使用一个select语句中的数据
我正在尝试编写一个包含多个select语句的存储过程。但是,第二条语句将使用第一条语句中返回的数据来确定第二条语句。这可能吗 例如:Mysql 在存储过程的另一个语句中使用一个select语句中的数据,mysql,sql,stored-procedures,Mysql,Sql,Stored Procedures,我正在尝试编写一个包含多个select语句的存储过程。但是,第二条语句将使用第一条语句中返回的数据来确定第二条语句。这可能吗 例如: (Start loop) Select ID, Value1, Value2 from table1 if Value 1 = Null then Select Value2(taken from results of first select) from Table2 end if (then loop through again) 我知道这有点含糊
(Start loop)
Select ID, Value1, Value2 from table1
if Value 1 = Null then
Select Value2(taken from results of first select) from Table2
end if
(then loop through again)
我知道这有点含糊不清,但我只是想知道这是否可行
感谢您的帮助使用MySQL过程。如何在MySQL过程中编写此过程?请参见