Re: query repeating results???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux