From: Martijn Tonies Date: May 9 2007 5:27pm Subject: Re: Query problem List-Archive: http://lists.mysql.com/mysql/206672 Message-Id: <02b201c7925f$60d308e0$9902a8c0@martijnws> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > how do I return a single row per property even if it has 3 or 4 images > attached to it. Please reply to the list instead of directly to me. You could do a: select p.from properties p where exists (select i.* from images i where i.property_id = p.property_id) > > >I have a table of properties that is linked to a table f images with a > > >one > > property to many images relationship. I >have manged this with nested > > queries but want to try and do it on one line. My current query > >> > >>$query = "SELECT * FROM images, properties WHERE images.property_id = > > properties.property_id"; > >> > >>As you can see from the query this returns a row for every image so if a > > property has 3 images associated with it >it will be returned 3 times. > > > > What exactly is your question? Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com