【发布时间】:2020-07-10 14:03:50
【问题描述】:
我已经写了以下查询 -
SELECT element_name,
element_start_date,
element_end_date,
period_name,
element_classfication,
Person_number
from per_elements
where element_name in ('Employer Contribution','HSA Employee Contribution')
给出以下输出
Element_name element_start_date element_end_date Period_name element_classfication Person_number Amount
Employer Contribution 6/14/2020 6/27/2020 14 2020 Biweekly Liability 100 38
HSA Employee Contribution 6/14/2020 6/27/2020 14 2020 Biweekly Deduction 100 19
我可以更改上面的查询,以便得到以下输出 -
element_start_date element_end_date Period_name Person_number Employer contribution amount Employee contribution amount
6/14/2020 6/27/2020 14 2020 Biweekly 100 38 19
我可以将单独的行转换为列,以便可以并排反映金额。
【问题讨论】:
-
Google
pivot query完成此类任务。
标签: sql oracle oracle-sqldeveloper plsqldeveloper