我有以下查询:
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
我需要选择所有内容和总和,有没有办法在不为每个单独字段编写长选择查询的情况下做到这一点?