I got a table containing 3 columns:
NameColumn CategoryColumn QuantityColumn
Name1 Category1 5
Name2 Category1 8
Name3 Category1 10
Name4 Category2 3
Name5 Category2 15
Name6 Category2 7
I need to write a query to convert the above data into the following result set:
NameColumn CategoryColumn QuantityColumn
Category1 NULL NULL
Name1 NULL 5
Name2 NULL 8
Name3 NULL 10
Category2 NULL NULL
Name4 NULL 3
Name5 NULL 15
Name6 NULL 7
Is there anyway to do this without using cursors?
Thanks.
SQL Fiddle example