Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to concatenate 2 specific values in a field

Status
Not open for further replies.

elsenorjose

Technical User
Oct 29, 2003
684
US
I have a view that includes a field called ProjTypeName for Project Type Name. In that field, there are 4 values: Active Pharmaceutical Ingredient Manufacturing, Drug Product Manufacturing, Packaging, and Labeling. These serve as group names in a Crystal Report. I have been asked to concatenate the Drug Product Manufacturing and Packaging project types to create a pseudo-project. I'm thinking it's a combination of CASE and concatenation, but my SQL skills are pretty weak. Can anyone suggest a simple way to alter the view so that I will have 3 project types now? I'm using SQL Server 2005.

Thanks
 
select case when ProjTypeName = 'Packaging' then 'Some New Type' else ProjTypeName end as NewProjectType
 
And if you need nested...

Code:
select case when ProjTypeName = 'Packaging' then 'Some New Type' 
else
case when ProjTypeName = 'Labeling' then ProjTypeName + ' ' LaLaField
else 
ProjTypeName end end as NewProjectType
 
Thanks you two. That was so obvious, I can't believe I missed it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top