sql quer


SELECT
(SELECT COUNT (sysid)
FROM FwInvConsumable
WHERE parentref = g.sysid
AND (ns.state = 'Inventory' OR ns.state = 'Qualification')),

(SELECT COUNT (ns.sysid)
FROM FwInvConsumable ns--,FWINVCONSUMABLEGROUP g
WHERE ns.parentref = g.sysid)
FROM FWINVCONSUMABLEGROUP g, FwInvConsumable ns

 

 

 

where (select count(sysid) from FwInvConsumable where parentref = g.sysid and (ns.state = 'Inventory' or ns.state = 'Qualification')) = " +
" (select count(ns.sysid) from FwInvConsumable ns,FwInvConsumableGroup g where ns.parentref = g.sysid)";

 

 

SELECT ID, partnumber, partrevision
FROM fwinvconsumablegroup
WHERE (SELECT COUNT (sysid)
FROM fwinvconsumable
WHERE parentref = fwinvconsumablegroup.sysid
AND state <> 'Terminated') = 0

posted @ 2016-01-05 17:45  sunshinelym  阅读(175)  评论(0编辑  收藏  举报