Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 在存储过程的另一个语句中使用一个select语句中的数据_Mysql_Sql_Stored Procedures - Fatal编程技术网

Mysql 在存储过程的另一个语句中使用一个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) 我知道这有点含糊

我正在尝试编写一个包含多个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)
我知道这有点含糊不清,但我只是想知道这是否可行


感谢您的帮助

使用MySQL过程。如何在MySQL过程中编写此过程?请参见