帮忙写个小SQL,立即给分
表A: 
 字段:NO,S 
 NO-S 
 1   -3 
 2   -1 
 3   -2   
 表B: 
 字段:NO,S,DETAIL 
 NO-DETAIL 
 1-   987 
 1-   988 
 1-   986 
 2-   10 
 3-   12 
 3-   111   
 NO为1的下面有3个元素,这三个元素在表B中具体记录了分别是987,988,986。   
 我现在要写一条SQL,要求表A中里的元素总数记录(3)减去表B中的对应详细记录(987,988,986)条数 也就是 3-count(DETAIL)  
 等于0,小于0,大于0   
------解决方案--------------------select (select s from a where no=1) - 
        (select count(*) from b where no=1) as tmp 
 from dual
------解决方案--------------------select a.s-(select count(b.no) from b where b.no=a.no group by b.no) from a 
 有条件后边可加上where a.no=1