You're trying to do a Sub-query, Sub-queries aren't supported until version 4.1.x You could do a simple join/group to get these results:
SELECT cities.id, cities.name, COUNT(images.city_id) as number_of_images FROM cities LEFT JOIN images ON(images.city_id = cities.id) GROUP BY cities.id -----Original Message----- From: Nuno Mendes [mailto:[EMAIL PROTECTED] Sent: Saturday, December 20, 2003 8:28 AM To: [EMAIL PROTECTED] Subject: RE: Problem with sql sintax I'm using 4.0.17. Isn't this SQL supported in this version? Nuno Mendes -----Original Message----- From: Colleen Dick Sent: Saturday, December 20, 2003 3:15 PM To: Nuno Mendes Cc: [EMAIL PROTECTED] Subject: Re: Problem with sql sintax What version you using? Subselects are not supported in any except the latest Nuno Mendes wrote: > The sql bellow is giving a sql sintax error: > > select > cities.id, > cities.name, > ( > select > count(*) > from images > where ( images.city_id = cities.id ) > ) as number_of_images > from cities > > Can you point me what am I doing wrong? Thank you! > > Nuno -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]