'Sql determine rows that dont have value

I have a table that returns results like

abc   yes
abc   no
cdef  no
cdef  no
cdef  no
xyz   yes
xyz   no
xyz   no

sample query

with abc as(
select 'abc' as b , 'yes' as a
union all
select  'abc', 'no'
 
union all
select  'cdef', 'no'
union all
select  'xyz', 'no'
union all
select  'xyz', 'no'
)
 select * from abc

I want to return results that show accounts and indicate yes if they have a yes in any row and no if they dont so should look like this

abc yes
cdf no
xyz yes.

How can I do this?



Solution 1:[1]

A simple aggregation should do the trick.

Select Col1
      ,Col2 = max(Col2)
 From  YourTable
 Group By Col1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Cappelletti