如果给定多行数据,我该如何检索结果
结果基于已执行的列。条件以tserv_id'DISCHARGE'开头,以'ONPOWER'结束。
条件:
代码:
-Ofast
答案 0 :(得分:2)
使用聚合:
select min(Case tserv_id when 'Discharge' then PERFORMED end) as tserv_discharge,
min(Case tserv_id when 'ONPOWER' then PERFORMED end) as tserv_onpower,
min(Case tserv_id when 'YARD2TRUCK' then PERFORMED end) as tserv_yard2truck,
min(Case tserv_id when 'FULL OUT' then PERFORMED end) as tserv_fullout,
min(Case tserv_id when 'FULL IN' then PERFORMED end) as tserv_fullin
from ODS_REEFER
where EQ_NBR = 'EGSU5014174';