数据库SQL2000
以下两条语句,如何合并成一条:
select qid,count(qid) as cis from test group by qid
select * from test as t1 where exists(select * from test as t2 where t1.QID=t2.ID) and t1.TID="&TID&"
请大家帮帮忙
以下两条语句,如何合并成一条:
select qid,count(qid) as cis from test group by qid
select * from test as t1 where exists(select * from test as t2 where t1.QID=t2.ID) and t1.TID="&TID&"
请大家帮帮忙
(select count(*) from test where qid=t1.qid)from test as t1 where exists(select * from test as t2 where t1.QID=t2.ID) and t1.TID="&TID&"
select qid,count(qid) as cis from
(select * from test as t1 where exists(select * from test as t2 where t1.QID=t2.ID) and t1.TID="&TID&") z
group by qid
(select count(*) from test where qid=t1.qid)
from test as t1
where exists
(select * from test as t2 where t1.QID=t2.ID) and t1.TID="&TID&"