RE: [PHP] Duplication Results When LEFT JOIN is Used Between MultipleTables
| From: | Chadwick, Russell | Date: | Wed, 11 Jul 2001 17:30:07 +0000 |
| Subject: | RE: [PHP] Duplication Results When LEFT JOIN is Used Between MultipleTables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-57446@lists.php.net to get a copy of this message | ||
Sounds like you want a GROUP BY bibID, then you'll have to put group by
functions on all the items you are selecting.
-----Original Message-----
From: Mike Gifford [mailto:mike@openconcept.ca]
Sent: Wednesday, July 11, 2001 10:00 AM
To: Kamil Choma
Cc: php-general@lists.php.net
Subject: Re: [PHP] Duplication Results When LEFT JOIN is Used Between
MultipleTables
I added DISTINCT to the code (as per below):
Kamil Choma wrote:
> Mike Gifford wrote:
>>However, when I run this query:
>>mysql_query("SELECT DISTINCT
>> 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....
> Maybe SLECT DISTINCT ... could help you.
However not everything needs to be distinct. Just the bibID number
actually.
The results this produces though are no different than without it.
Mike
--
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Abolish Nuclear Weapons Now!: http://pgs.ca/petition/
It is a miracle that curiosity survives formal education. - A Einstein
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net