求一条sql语句,gc表字段有gh,uploadflag,img表字段有gh,tagid,uploadflag,pic表字段有gh,tagid,uploadflag.
现在需要查询出来gc表中uploadflag=0并且img的tagid=0,uploadflag=1和tagid=1,uploadflag=1,表pic的tagid=1,uploadflag=1,
换个说法就是查询出gc表中uploadflag=0并且满足有3张照片已经上传的gh,
img表和pic表分别表示不同阶段的图片,tagid为0到9表示不同的流程,
不能用存储过程实现,因为数据库操作类不支执存储过程
------解决思路----------------------
不知道理解的对不对
select * from gc where uploadflag=0
and exists (select * from img where gh=gc.gh and uploadflag=1 and (tagid=0 or tagid=1))
and exists (select * from pic where gh=gc.gh and tagid=1 and uploadflag=1)