You are here: Re: SQL question « All PHP « IT news, forums, messages
Re: SQL question

Posted by lallous on 02/01/06 09:56

Hello Simon,

(Answer inline)

"Simon" <simon@webworx.co.uk> wrote in message
news:LQvDf.76710$W4.29424@newsfe4-gui.ntli.net...
> 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
>

Exactly!

But that wasn't my question.

I guess Bill addressed my problem but I haven't gotten time yet to
experiment with his solution.

--
Elias
> "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

 

Navigation:

[Reply to this 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

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