User-219423983 posted
Hi maggiemays
Could you share your table structure?
As I’m not sure how your table be built, you could have a look at the following demo by using Group By and maybe it would helpful to you.
declare @table table(cartypeName varchar(20),cartypeValue int)
insert into @table values('convertible',300)
insert into @table values('convertible',400)
insert into @table values('convertible',600)
insert into @table values('sedan',200)
insert into @table values('sedan',100)
insert into @table values('sedan',500)
insert into @table values('XXX',100)
insert into @table values('XXX',200)
--Create the Temporary table to stored the multiple values
declare @temp table(val varchar(20))
insert into @temp values('convertible')
insert into @temp values('sedan')
select SUM(cartypeValue) as CountValue, cartypeName
from @table
where cartypeName in (select val from @temp)
Group by cartypeName
Best Regards,
Weibo Zhang