Posted by Bill Karwin on 10/12/01 11:38
"lallous" <lallous@lgwm.org> wrote in message
news:444lnsFcecpU1@individual.net...
> How can I write a 3.23 compatible MySQL statement to list all mailing
> lists names and a field that designates whether a user with a given ID is
> subscribed to it or not?
I think something like this should work:
SELECT L.name, U.username, IF(S.userid IS NULL, 'NO', 'YES') AS
is_subscribed
FROM mailinglist AS L
LEFT OUTER JOIN subscribers AS S ON (L.listid = S.listid)
RIGHT OUTER JOIN users AS U ON (U.userid = S.userid);
Regards,
Bill K.
[Back to original message]
|