I have a table named "details" which looks like this:
UID |caste|
001 | 1 |
002 | 1,2 |
003 | 2 |
004 | 1 |
How do I select uids which have the same caste like this:
UID |sameuidcaste
001 | 002
001 | 004
I have tried this code but it doesn't give what I want:
select a.uid from details as a right join
details as b on a.caste = b.caste where b.caste like '%3%'
Any hint will be appreciated! Thank you!