Reply to Re: SQL question

Your name:

Reply:


Posted by Simon on 01/30/06 23:48

mailinglist(listid, name)
subscribers(userid, listid)
users(userid, username)

SELECT ml.name from mailinglist ml,subscribers s, users u
WHERE u.userid=s.userid
AND ml.listid = s.listid
AND u.userid = $user_id

pass the $user_id for the given userid and you will get all mailing list
names that the user has subscribed to

"lallous" <lallous@lgwm.org> wrote in message
news:444lnsFcecpU1@individual.net...
> Hello list,
>
> I have three tables:
>
> mailinglist(listid, name)
> subscribers(userid, listid)
> users(userid, username)
>
> A given user can belong to multiple mailing lists and his membership is
> defined by an entry in subscribers table.
>
> 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?
>
> Currently, I am doing two queries then glueing them through a PHP script.
>
> Regards,
> Elias
>
>

[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

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