I have a number of real estate properties, each associated with one or 
more city.  If I select by specifying a city then I get a list of unique 
properties.  But if I do a broader select, then I get duplicates of the 
property record when a record is assocuated with two or more cities.  How 
do I limit the select results returned so that I get no more than one of 
each property record?

SELECT p.propertyid, p.name, c.name AS city
FROM property p
  INNER JOIN property_city pc ON pc.propertyid = p.propertyid


property
--------------
propertyid
name

city
--------------
cityid
name

property_city
--------------
propertyid
cityid


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217388
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to