有一个变量sum,表1 有一个number,表2 有no ,还有一个status。
现在的问题是,查询语句要达到的效果是,表1.number=表2.no,二者都要等于sum,然后表2.stasus="false".应该什么写select 语句呢???两张表查询我不会。
"select * from 表1,表2 where 表1.number=表2.no and 表2.stasus="false" and 表2.no=" + sum
declare @sum int;
set @sum = 10; --
select * from 表1 table1,表2 table2 where table1.number=table2.no and table2.stasus='false' and table1.num=@sum;
select * from 表1,表2 where 表1.number = 表2.no and 表2.status = false and 表2.no = sum