Q&A for programmers
create table #t (maker varchar(100), model varchar(100), type varchar(100) ); insert into #t ( maker, model, type ) values ( 'B', '1121', 'pc'), ( 'A', '1233', 'pc'), ( 'E', '1260', 'pc'); ;with totals as ( select maker, type, count( * ) as n from #t group by maker, type ) , maker_type as ( select distinct maker, type from #t ) select mm.*, t.n, case when t.n is null then 'No' else 'Yes' end as yes_no from maker_type mm left outer join totals t on mm.maker = t.maker and mm.type = t.type
Error: looks like you typed in the wrong words - try again