Home > database >  Online in a SQL statement!!!!!!
Online in a SQL statement!!!!!!

Time:10-20

Have a millions of lines of the order form, first listed several rows
Order_id price key
1001 10, 80-100
1001 20, 90-200
1002 to 30, 70-130
1002 40, 80-140
1002 50, 90-150

Need to press the order number to merge the key value, obtain the following results
Order_id price key newkey
1001 10, 80-100, 80-100, living - 200
1001 to 20, 90-200, 80-100, living - 200
30, 70-130, 70-1002, 130-140, living - 150
40, 80-140, 70-1002, 130-140, living - 150
50, 90-150, 70-1002, 130-140, living - 150

CodePudding user response:

More than 2017, the use of string_agg,
  • Related