<分区>
我有一个返回 50 个结果的选择查询。选择查询返回 id 。
下一部分我需要运行一个选择查询,查询所有 50 个 ID 的值。
请有人告诉我完成它的最佳方法是什么。 使用 for 循环是个好主意 例如
begin
declare @count= select id from table1
for 1 to @count ..loop
select value from table2 where id =1
end loop
我可以使用游标吗?什么是最好的方法。