Hi Miguel,
You'll need to use LEFT JOIN, that will show all records that match and a row
in the second table will all values NULL where there is no match. Then you
find all those rows that have no match in your WHERE clause.
Regards,
Gavin Towey
-Original Message-
From: Miguel Vaz [ma
If the aim is purely to find the progs without events, it might be more
efficient to use something like
select * from progs where not exist (select id_prog from events where
id_prog = progs.id_prog);
My syntax might be off, check "not exists" documentation for more info.
On Tue, Dec 15, 2009 at
Thanks all for the feedback. Here's what i did:
select p.id_prog,count(r.id_event) e from programas p left join(events r)
on(p.id_prog=r.id_prog) group by r.id_event
This gives me a list of all the distinct progs with a count of how many
events on each. I then delete the empty ones.
It would be
>-Original Message-
>From: Miguel Vaz [mailto:pagong...@gmail.com]
>Sent: Wednesday, December 16, 2009 9:39 AM
>To: Johan De Meersman
>Cc: Gavin Towey; mysql@lists.mysql.com
>Subject: Re: Count records in join
>
>Thanks all for the feedback. Here's what i d
essage-
> >From: Miguel Vaz [mailto:pagong...@gmail.com]
> >Sent: Wednesday, December 16, 2009 9:39 AM
> >To: Johan De Meersman
> >Cc: Gavin Towey; mysql@lists.mysql.com
> >Subject: Re: Count records in join
> >
> >Thanks all for the feedback. Here's what i