Tuesday, 6 August 2013

Joining several sql columns into one

Joining several sql columns into one

I need some help here. I'm trying to combine some numbers and items into
basically two columns. I have a table that has 7 Item columns and 7 qty
columns along with a date and id field.

How can I combine them all into basically a couple of columns, even if the
items repeat? Im trying to do something like this: Item1 | QTY | DATE With
Item 1 perhaps repeating as many times as its in the columns.
I'm not normally a SQL guy here so please bare with me.
Here is my current select statement
SELECT TOP (100) PERCENT Item1, Qty1, Item2, Qty2, Item3, Qty3, Item4,
Qty4, Item5, Qty5, Item6, Qty6, Item7, Qty7, Date, ID
FROM dbo.ITEMREPORT1

No comments:

Post a Comment