Reply to Re: SQL question

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация