select * from TB_Data_1_5 where Picname in ( select picname from TB_Picture where batchname='+Quotedstr(CurrBatchName)+' and User5='+QuotedStr(TLoginUser.Instance.UserID)+' ) and batchname='+Quotedstr(CurrBatchName);
select picname from TB_Picture where batchname='+Quotedstr(CurrBatchName)+' and User5='+QuotedStr(TLoginUser.Instance.UserID)+' 这个查询返回一个含有picname字段的结果集合, 相当于select * from TB_Data_1_5 where Picname in ('张三','李四','王五')
哈哈。我不看。就问你们得了!!还有我不是MM,我是GG!
select * from TB_Data_1_5 where Picname in ( select picname from TB_Picture where batchname='+Quotedstr(CurrBatchName)+' and User5='+QuotedStr(TLoginUser.Instance.UserID)+' ) and batchname='+Quotedstr(CurrBatchName);这样子写,要是有问题,很难找啊,还是好好的格式化一下。
这句的意思是在TB_Data_1_5查询,条件是Picname 必须在后边select查询的数据之中。
相当于select * from TB_Data_1_5 where Picname in ('张三','李四','王五')