17,086
社区成员
发帖
与我相关
我的任务
分享
-- Create table
create table T_TEST
(
PRJID VARCHAR2(20),
PROCID NUMBER(20),
CONTENT1 NUMBER(20),
CONTENT2 VARCHAR2(1)
)
select t.prjid,max(t.procid) procid,
(select content1 from t_test where content2 = 'a' and prjid=t.prjid) content1,
(select content1 from t_test where content2 = 'b' and prjid=t.prjid) content2,
(select content1 from t_test where content2 = 'c' and prjid=t.prjid) content3,
(select content1 from t_test where content2 = 'd' and prjid=t.prjid) content4
from t_test t group by t.prjid