I’m attempting to get the list of personid’s which has two different TYPE%'s (without it being the same type).
See the table below, personid 100 would satisfy because of TYPE1 and TYPE2, but personid 200 would not because of only having TYPE1 twice.
columnid | personid | type
1 | 100 | TYPE1
2 | 100 | TYPE2
3 | 100 | TYPE1
4 | 200 | HELLO
5 | 200 | TYPE1
6 | 200 | TYPE1
7 | 101 | WORLD
I’m working towards using the GROUP BY statement, this obviously catches the personid’s with the same TYPE as mentioned above. Is there any way to add a distinct of some kind so that doesn’t happen?
SELECT typetable.personid
FROM typetable
WHERE typetable.type like 'TYPE%'
GROUP BY typetable.personid
HAVING count(*) > 1