You are here: Re: PHP 5 / MySQL 5 subquery problem « PHP SQL « IT news, forums, messages
Re: PHP 5 / MySQL 5 subquery problem

Posted by Diogenes on 10/12/06 17:59

Kudos to the Captain! That works beautifully both on the
command line and in PHP!

Thank you! Thank you! Thank you!

Cheers
Jim

Captain Paralytic wrote:
> Diogenes wrote:
>
>>Captain Paralytic wrote:
>>
>>>Diogenes wrote:
>>>
>>>>SELECT pkey, Name FROM tracks WHERE artist="Rolling Stones"
>>>>AND pkey NOT IN (SELECT Song FROM requests WHERE client="jim")
>>>>
>>>
>>>
>>>It is almost always more efficient to use the LEFT JOIN alternative for
>>>this task
>>>
>>
>>I'm a little naive on SQL. Could you redo the above SELECT
>>statement with your suggested alternative? Then I'll try it
>>in PHP.
>>
>>Cheers
>>Jim
>
>
> Without seeing the scheme and some sample data I can't be sure that
> I've captured all the nuances of what you want, but try:
>
> SELECT pkey, Name FROM tracks
> LEFT JOIN requests ON tracks.pkey = requests.Song AND requests.client =
> "jim"
> WHERE tracks.artist="Rolling Stones" AND requests.Song IS NULL
>

 

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

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