BeachSandGuy
Programmer
Hi,
I am preparing a sql query to put into an rdl report for SQL Server. I have data which I would like to show up in two columns (for printing purposes).
Table looks like this:
SiteCode | Description
BU | Buffalo
DU | Duluth
MI | Miami
PH | Phoenix
I'd like to write a query so the results would look like this:
SiteCode | Description | SiteCode | Description
BU | Buffalo | MI | Miami
DU | Duluth | PH | Phoenix
I've added another column to indicate column like so:
SiteCode | Description | Column
BU | Buffalo | 1
DU | Duluth | 1
MI | Miami | 2
PH | Phoenix | 2
And then
Select
Case when Column=1 Then SiteCode Else Null End as 'Col 1',
Case when Column=2 Then SiteCode Else Null End as 'Col 2'
From Table
It works except I have a bunch of nulls,
Col 1 | Col 2
BU | Null
DU | Null
Null | MI
Null | PH
Any suggestions?
As always Thank you for taking the time, this is a great forum, searched, couldn't find a similar issue.
Ian
I am preparing a sql query to put into an rdl report for SQL Server. I have data which I would like to show up in two columns (for printing purposes).
Table looks like this:
SiteCode | Description
BU | Buffalo
DU | Duluth
MI | Miami
PH | Phoenix
I'd like to write a query so the results would look like this:
SiteCode | Description | SiteCode | Description
BU | Buffalo | MI | Miami
DU | Duluth | PH | Phoenix
I've added another column to indicate column like so:
SiteCode | Description | Column
BU | Buffalo | 1
DU | Duluth | 1
MI | Miami | 2
PH | Phoenix | 2
And then
Select
Case when Column=1 Then SiteCode Else Null End as 'Col 1',
Case when Column=2 Then SiteCode Else Null End as 'Col 2'
From Table
It works except I have a bunch of nulls,
Col 1 | Col 2
BU | Null
DU | Null
Null | MI
Null | PH
Any suggestions?
As always Thank you for taking the time, this is a great forum, searched, couldn't find a similar issue.
Ian