sql - Grouping and counting issue -


i have table this:

id,code, (some more columns) 1, c 1, 1, b 1, b 1, b 2, -- desired row 3, b 3, c 3, 3, 

i want 1 id (or all) have been associated 'a' , not 'b' , 'c'. how do ?

what tried now:

select * ( select id, count(case when code='a' 0 else 1 end) c tbl group id ) c = 0 

why not work ?

this list of id values associated codes of 'a'.

select id tbl group id having max(case when code='a' 0 else 1 end) = 0 

see fiddle live demo.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -