Is it possible to derive 2 values in a CASE statement?
I need to INSERT multiple column values w/ a nested select using a Case Statement. (perhaps a SET statement w/in the CASE statement??)
TABLE_XYZ has 4 columns: Cust_No, City_Name, City_Abbr, City_Count
INSERT INTO TABLE_XYX
SELECT CustomerNo,
case when CityID = 44
then 'Los Angeles', 'LA'
else 'Other', 'Other'
end,
count(*)
from TABLE_1
GROUP BY CustomerNo, CityID
I need to INSERT multiple column values w/ a nested select using a Case Statement. (perhaps a SET statement w/in the CASE statement??)
TABLE_XYZ has 4 columns: Cust_No, City_Name, City_Abbr, City_Count
INSERT INTO TABLE_XYX
SELECT CustomerNo,
case when CityID = 44
then 'Los Angeles', 'LA'
else 'Other', 'Other'
end,
count(*)
from TABLE_1
GROUP BY CustomerNo, CityID