1
我有以下查詢:選擇所有內容和一筆?
select *, sum(hrs.WPTOTT) as "Hours"
from mstwmlt
inner join MSTWMPRD hrs
ON hrs.WPOPID = wtopid and hrs.WPTRAN = wtttyp
and (wttdte BETWEEN hrs.WPSDTE AND hrs.WPEDTE)
where (wtwh = ? OR ? = '*ALL')
AND (wtopid = ? OR ? = '*ALL')
AND (wtttyp = ? OR ? = '*ALL')
and ((wtco|| '/' || wtdiv) = ?)
order by wttdte, wtopid, wtttme, wtttyp
,我需要選擇一切的總和,是有辦法做到這一點沒有寫很長的選擇查詢爲每個單獨的領域?
你使用什麼數據庫服務器?這可能會改變你的選擇。 –