Re: SELECT mit NOT EXISTS
Hi,
one more question.
I got my query now I want to have the name from the person Table and the Email vom the adress table. But there can be more than just on adress table. I tried to do it like this:
select
person_id, name, vorname, email
sum( if(detail_id=6 and status=1,1,0) ) as d1s1,
sum( if(detail_id=3 and status=0,1,0) ) as d2s0,
sum( if(detail_id=3,1,0) ) as d4
from detailzuordnung
LEFT JOIN person ON (detailzuordnung.person_id = person.id)
LEFT JOIN adressen ON (adressen.Person_id = adressen.Person_id)
group by person_id
having (d1s1>0 and d2s0>0) OR (d1s1>0 and d4=0)
but it is not workin it allways tells me that the person_id is ambigous
If I just use the first LEFT JOIN for person it is working.
Do you have any Idea what I can do?
Thank you