[thelist] using SQL left join query and NULL to find records NOT in a table

Ben Phillips ben at inchima.com
Fri Feb 15 07:22:01 CST 2002


> anyhow...
>
> nice design
>
> congrats for not doing this in the application logic

why thankyou! :o)

> as for your problem, you were so close --
>
>      select * from USER
>          left join   NEWSLETTER_SENT
>               on USER.userid = NEWSLETTER_SENT.userid
>                           and NEWSLETTER_SENT.newsletterid='$n'
>          where NEWSLETTER_SENT.userid is NULL
>

brilliant, thanks! i tried it with: NEWSLETTER_SENT.newsletterid='$n' in the
where clause!! no wonder i couldn't get my head round it.

thanks for freeing me up to do some actual work today! :o)

benji
inchima.com




More information about the thelist mailing list