T-SQL Combining Data in One Field
Posted on 2013-06-13
Let's say that you have a table with two columns. One column is order number, while the other column is tracking number.
Further, let's say that you can have more than one tracking number for each order.
Now, say that I want to do a select statement that displays one record for every order number. Even if there is more than one tracking number, I want each tracking number in that one record.
So, let's say that for one order there are the following tracking numbers for one order:
And, let's say that the order number is 1234.
I want the following records returned:
1234 1X200, 2X300, 3X400
What syntax do I use, to do so?