开发者

Iterating select query in store procedure

I am in a situation where a stored procedure have to execute

Query1:

开发者_如何学C
select columnName from tablename where=(some condition)

and using the output of this query which I don't know in which data type to store it,I want to execute another query which has to be executed in the same stored procedure and which depends on output of query 1.

Query2:

select * from tablename where column2=(result of query1)

Please tell me how I can achieve this, basically I am looking for something like ResultSet in Java or DataReader in C# in Mysql.


select t2.col1, t2.col2, t2.col3 from tablename t2 
join tablename t1 on t1.columnname = t2.column2
where (some condition) 

Pick your columns like that, then you can check the table for an appropate variable to store the field

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜