Re: Duplication Results When LEFT JOIN is Used Between MultipleTables
| From: | Kamil Choma | Date: | Wed, 11 Jul 2001 18:19:25 +0000 |
| Subject: | Re: Duplication Results When LEFT JOIN is Used Between MultipleTables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57411@lists.php.net to get a copy of this message | ||
Mike Gifford wrote:
> However, when I run this query:
>
> mysql_query("SELECT
> WLPbib.bibID,
> WLPbib.title,
> WLPbib.publisher,
> WLPbib.publicationDate,
> WLPaddress.city,
> WLPaddress.state,
> WLPprofile.firstName,
> WLPprofile.lastName,
> WLPprofile.organization,
> WLPcountry.languageName
> FROM WLPbib
> LEFT JOIN WLPprofile ON WLPprofile.profileID = WLPbib.profileID
> LEFT JOIN WLPaddress ON WLPaddress.publisherID = WLPbib.publisherID
> LEFT JOIN WLPcountry ON WLPcountry.countryID = WLPaddress.countryID");
>
> I now get results in triplicate. ie. I'm getting three copies of the same
> title, firstName, organization, etc....
>
> I somehow suspected that this should be the result with LEFT JOIN, but I'm not
> sure how to return a query without duplication.
>
> This is far better than what I had this morning (which was no response from the
> server).
>
> Thanks. I'm new to joining tables...
>
> Mike
> --
Maybe SLECT DISTINCT ... could help you.
Kamil
--
----------------------------------
choma@fmph.uniba.sk
----------------------------------