AndyHopper
Programmer
I have a table with some property information, another table with some more information about those properties, a table which contains the relationships between media files and properties and a table to contain media. When I use joins to get the information I'm looking for I return more rows than I'd like. For example a simple search may yield:
Boston, MA - $2,000,000 - pic1.jpg
Boston, MA - $2,000,000 - pic2.jpg
Boston, MA - $2,000,000 - pic3.jpg
Needham, MA - $1,000,000 - pic2.jpg
Needham, MA - $1,000,000 - pic3.jpg
Here's the query I'm currently using:
SELECT some fields
FROM property LEFT OUTER JOIN
property_ext ON property.pid = property_ext.pid LEFT OUTER JOIN
media INNER JOIN
media_rels ON media.media_id = media_rels.media_id ON property.pid = media_rels.pid
How can I limit the results to one row per unique property?
Thanks in advance,
Andy
Boston, MA - $2,000,000 - pic1.jpg
Boston, MA - $2,000,000 - pic2.jpg
Boston, MA - $2,000,000 - pic3.jpg
Needham, MA - $1,000,000 - pic2.jpg
Needham, MA - $1,000,000 - pic3.jpg
Here's the query I'm currently using:
SELECT some fields
FROM property LEFT OUTER JOIN
property_ext ON property.pid = property_ext.pid LEFT OUTER JOIN
media INNER JOIN
media_rels ON media.media_id = media_rels.media_id ON property.pid = media_rels.pid
How can I limit the results to one row per unique property?
Thanks in advance,
Andy