Re: query repeating results???
| From: | Brent Baisley | Date: | Fri, 26 Mar 2004 13:51:16 +0000 |
| Subject: | Re: query repeating results??? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33655@lists.php.net to get a copy of this message | ||
Try left joining your states table also. MySQL may be joining the property_photos and the states table first, which would screw up your left join. Haven't had my morning coffee yet so I can't say for sure. Put EXPLAIN in front of your query to see what MySQL is doing.
SELECT
...
FROM
properties
LEFT JOIN states ON properties.state_id=states.id
LEFT JOIN property_photos ON property_photos.property_id=properties.id
WHERE
states.code='fl'
On Mar 26, 2004, at 1:45 AM, Katie Dewees wrote:
I am running the following query: SELECT ...stuff... FROM properties LEFT JOIN property_photos ON property_photos.property_id=properties.id, states WHERE states.code='fl' AND properties.state_id=states.id LIMIT 0, 10 -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577