我试图为来自我的第一列的每个非重复值添加一个“total count”行。我尝试创建一个UNION ALL,但却把事情弄得一团糟。(基于TL.OP_CODE值。)任何帮助都非常感谢。对我的格式设置感到抱歉...
select
tl.op_code as "OPS Code", tl.current_status AS "Status", tl.service_level as "Service",
tl.Bill_number as "Bill number", tl.trace_no as "Trace No",
tl.pick_up_by AS "PU By", tl.origname, tl.origcity, tl.origprov,
tl.deliver_by AS "DEL By", tl.destname, tl.destcity, tl.destprov, tl.pallets
from tlorder tl
where tl.current_Status NOT IN ('CANCL')
order by tl.op_code, tl.currency_code, tl.pick_up_by
2条答案
按热度按时间mwkjh3gx1#
请尝试以下方法:
| 操作代码|A级|B|碳纳米管|
| - -|- -|- -|- -|
| 一个|一个|一个||
| 一个|一个|2个||
| 一个|||2个|
| 2个|一个|一个||
| 2个|||一个|
kcrjzv8t2#
例如,如果我有student_score表,并且我试图在此处获得不同分数的分数总和,则使用Rollup。