得到兩個不同的語句單一輸出你好,這是我的輸出格式:如何使用SQL
--------------------------------------------------------------------------------
CLASS TOTAL NO OF STUDENTS STUDENTS PURCHASED REMAINING STUDENTS
1A 52 26 26
- 這裏student_table「包含學生證和類。
- 'purchase_table'包含學生ID購買禮服的人。
現在我想要以上述格式的結果(有多少學生屬於'1A'類,購買學生數和非購買學生數)。
我使用此查詢,但我只得到不購買學生的結果。
select count(studentid)
from student_table
where studentid not exists (select studentid from 'purchase_table')
;
有人幫忙解決了這個問題。
你正在使用什麼數據庫? – Sibster 2013-05-07 11:20:37