我有時間的地獄搞清楚如何總量這兩個查詢的總結:總結計數(與GROUP BY)
select t.processed as title, count(t.processed) as ckos
from circ_longterm_history clh, title t
where t.bib# = clh.bib#
and clh.cko_location = 'dic'
group by t.processed
order by ckos DESC
select t.processed as title, count(t.processed) as ckos
from circ_history ch, title t, item i
where i.item# = ch.item#
and t.bib# = i.bib#
and ch.cko_location = 'dic'
group by t.processed
order by ckos DESC
基本上我想有一列的結果集爲t.processed另一列是第一個計數加上第二個計數的總和。
任何想法?
是'在'title' t.processed'獨特之處?我們可以得到樣本數據和目標結果嗎?我假設你想要的結果也是按't.processed'匹配的,而不是'第一行',正如'ORDER BY'所暗示的。 –
t.processed實際上並不是唯一的。我正在尋找將circ_history和circ_longterm_history中的匹配的所有t.processed加起來 – Marc