Reply to Re: using DISTINCT with merged tables?

Your name:

Reply:


Posted by J.O. Aho on 04/02/06 08:02

Goomba wrote:
> i need to combine two tables, then retrieve unique results. this works, but
> it is also outputting all the movie_ids in mMovies as well, which results in
> duplicates. i only want one. how can i make this work? Thanks!!
>
> SELECT DISTINCT mMovies_Genres.movie_id, title_the, title, season, genre_id
> FROM mMovies, mMovies_Genres
> WHERE mMovies.movie_id = mMovies_Genres.movie_id
> AND bonusDisc is null
>
>

drop the mMovies_Genres.movie_id as all the entries (should at least be)
unique or you will get all. If you need to get this value too, then use GROUP
BY instead of DISTINCT.


//Aho

[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

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