0

Original table:

enter image description here

The attached image of the original table is a de-normalized table, created using a view which repeats customer names and order Ids.

Desired outcome:

enter image description here

I would like to keep the OrderId unique and merge products for each order in one row and separate it by comma.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Lokapedia
  • 105
  • 1
  • 4
  • 12
  • 1
    From my experience this question or how to split comma separated column is asked every day. – Lukasz Szozda Nov 10 '15 at 11:56
  • 1
    No, no, no, no! That is even worse. Use another table! – juergen d Nov 10 '15 at 11:56
  • 1
    @juergend First you should explain what is **First Normal Form** and why **non-atomic values** are bad – Lukasz Szozda Nov 10 '15 at 11:57
  • @lad2025: Yes, in an answer. This was just a comment. – juergen d Nov 10 '15 at 11:57
  • 1
    Its enough to put me in a coma... Ill get me coat –  Nov 10 '15 at 11:58
  • 1
    if it is for a display in a program it could be quite legit to use this method (although normally it is done programmatically and not from the sql side as far as I'm aware). For use just inside the sql itself is rather unique. @lokapedia maybe you should add a bit why it is necessary to use this different display inside sql? (as normally the , display is used in the client applications and not sql itself) – Thomas Nov 10 '15 at 12:20

0 Answers0