select * from tba
select * from tbb
怎么返回最后一个查询值.
还有不能用存储过程,因为SSIS中sql命令似乎不支持存储过程,请各位高手帮帮忙,谢谢了!
9 个解决方案
#1
勇子查询不行?
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 = ?)
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 = ?)
#2
select top 1 * from tbb order by id desc
#3
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 = ?)
order by id desc
#4
1楼正解
#5
+1
#6
+1
#7
--直接子查询,不需要存储过程
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 ='what')
#8
子查询或者动态拼接SQL语句。
#9
select * from b where exists(select 1 from a where a.col=b.col and a.col2='what')
#1
勇子查询不行?
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 = ?)
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 = ?)
#2
select top 1 * from tbb order by id desc
#3
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 = ?)
order by id desc
#4
1楼正解
#5
+1
#6
+1
#7
--直接子查询,不需要存储过程
SELECT * FROM tbb WHERE tbb.col1 in (SELECT col2 FROM tba WHERE col3 ='what')
#8
子查询或者动态拼接SQL语句。
#9
select * from b where exists(select 1 from a where a.col=b.col and a.col2='what')