Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Adding 2 columns if a condition is met

Author  Topic 

therev33
Starting Member

1 Post

Posted - 2009-06-15 : 17:15:32
I have 4 columns wbs1,wbs2,wbs3 and name.

WBS1 WBS2 WBS3 Name
123.1 Desc1
123.1 01 Desc2
123.1 01 01 Desc3

I am using...

SELECT [wbs1]as client,[name],[wbs2] + [wbs3]as [matter]
FROM [PRR_Inc].[dbo].[PR]
Where [status] = 'A' and [wbs2] <> ''

If WBS3 has data I need to combine the name column from line 2 before the name in line 3. The ultimate outcome of this should be 2 records returned...

Client '123.1' Matter '01' Name'Desc2'
Client '123.1' Matter '0101' Name'Desc2+Desc3'

It's been a long day hope this makes sense.

Thanks in advance!


RobertG
   

- Advertisement -