Im not sure how to explain this and im not use to SQL..this is my query which isnt working
select * from ao_addrcodes
JOIN a1_addrs on a1_addrid = ao_addrid left Join a2_name on a2_addrid = ao_addrid
where ao_codeid = 'DJ' and 'E' and 'A'
Trying to get a list of people who are in the table ao_addrid and their ao_codeid is ‘DJ’ and ‘E’ and ‘A’
So Fred would be in the table 3 times. His a2_addrid would be the same but would his
ao_codeid would be different
Each person has multiple records if they have multiple ao_codeid ‘s
help?
EDIT
ao_codeid , a2_addrid
'DJ', '525'
'E', '525'
'A', '525'
'DJ', '52'
'A', '25'
'E', '25'
So from the above data i would only want to see the user 525 appear. Not 52 or 25.
I am using MySQL
If you’re using SQL Server, then your WHERE statement is incorrect:
Or you could do it like this
EDIT 1
I would do something like this:
EDIT 2
Since you edited your post to say you’re using MySQL, this would be my solution: