Hi Guys,
Can someone help me with the below. I need to joins the below two so that I only have one column. I'm struggling how to get there.
SUM(CASE RepairCodes.[Service] WHEN 'Y' THEN 1 ELSE 0 END) AS SERVICE
,SUM(CASE ServCode WHEN 'MST' THEN 1 WHEN 'S&M' THEN 1 ELSE 0 END) AS SERVICE
I have tried the below but keep getting errors:
,SUM(CASE ServCode WHEN 'MST' THEN 1 WHEN 'S&M' THEN 1 WHEN SUM(CASE RepairCodes.[Service] WHEN 'Y' THEN 1 ELSE 0 END AS [SERVICE]
,SUM(CASE WHEN ServCode = 'MST' THEN 1 WHEN ServCode = 'S&M' THEN 1 WHEN RepairCodes.[Service] = 'Y' THEN 1 ELSE 0 END) AS [SERVICE]
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
December 21, 2020 at 4:38 pm
Thanks so much
December 21, 2020 at 6:48 pm
You're very welcome. Thanks for the feedback.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply