在這個http://sqlfiddle.com/#!6/aa0e17/4中,您可以看到id是主鍵並自動遞增,值列是int類型。要根據值獲取計數我做的4個不同的查詢如何獲取連接多個查詢
select count(id) from status where value=1
select count(id)from status where value=2
select count(id) from status where value=3
select count(id) from status where value=4
我的要求是獲得在一個查詢所有這些罪名。
爲什麼我要?
上表只是一個演示表,只有4個查詢,但在我的場景中,我有35個查詢,所以我必須在java中執行35個方法。
預期輸出:4,,4,4,4(第1查詢結果,第2個查詢結果,第3查詢結果,第4個查詢結果)
請後預期的輸出格式。 – 2015-02-11 08:03:00
@wewesthemenace請立即檢查 – SpringLearner 2015-02-11 08:05:32
那麼,您期待單行輸出? – 2015-02-11 08:07:42