Creating 2 columns from 1 column in a single table
SELECT TOP 1000 [Value]
FROM [OnlineQnres].[dbo].[tmp_DataSets]
WHERE [VariableID] in ('1')
UNION ALL
SELECT TOP 1000 [Value]
FROM [OnlineQnres].[dbo].[tmp_oDataSets]
WHERE [VariableID] in ('4')
Hi All, I have this select query above using UNION ALL. There is a column
called Value and VariableID in tmp_datasets table. I need to create 2
separate columns and name them val1 for variableID is 1 and val2 if
variableID is 4. If i use UNION ALL it works it creates 2000 records with
the first 1000 as val1 records and next 1000 as val2 records but does not
separate out into 2 sep columns. How do I sep this value column in 2 sep
columns as stated above.
No comments:
Post a Comment