Merge the data of two rows in a single table with the same content into one row for display. The value of the merge p1 and p2 fields. Createtabletest (p1varchar (10), p2varchar (10), p3varchar (10), p4varchar (10), p5varchar (10) None (selectaaa. p1, bbb. p2, aaa. p3, aaa. p4, aaa. p5from (selectRO
Merge the data of two rows in a single table with the same content into one row for display. The value of the merge p1 and p2 fields. Createtabletest (p1varchar (10), p2varchar (10), p3varchar (10), p4varchar (10), p5varchar (10) None (select aaa. p1, bbb. p2, aaa. p3, aaa. p4, aaa. p5 from (select RO
Merge the data of two rows in a single table with the same content into one row for display.
The value of the merge p1 and p2 fields.
Create table test
(
P1 varchar (10 ),
P2 varchar (10 ),
P3 varchar (10 ),
P4 varchar (10 ),
P5 varchar (10)
) <无>
(select aaa.p1, bbb.p2, aaa.p3, aaa.p4, aaa.p5 from (select ROW_NUMBER() OVER(ORDER BY ppp.p3) as RowNumber1, ppp.* from test ppp where ppp.p2 is null) aaa, (select ROW_NUMBER() OVER(ORDER BY qqq.p3) as RowNumber1, qqq.* from test qqq where qqq.p1 is null) bbb where (aaa.p3 = bbb.p3 and aaa.p4 = bbb.p4) ) union all( select * from test where (p3,p4) not in (select p3,p4 from test group by p3,p4 having count(*)>1))