You need to quote with backticks the `Vendor`.`count`.

Without the backticks the SQL interpreter thinks that you're
attempting to use the function count() again, so it's expecting
something to count but finds 'FROM' instead: hence the error.

So, make your SQL like this, and you should be okay:

SELECT
  `Vendor`.`name`,
  `Vendor`.`safe`,
  COUNT(Model.vendor_id) AS `Vendor`.`count`
FROM
  `vendors` AS `Vendor`
  LEFT JOIN `models` AS `Model` ON `Model`.`vendor_id` = `Vendor`.`id`
GROUP BY `Vendor`.`id`
ORDER BY `Vendor`.`name`  ASC

As an aside, I think you can safely replace
  ON `Model`.`vendor_id` = `Vendor`.`id`
with
  USING (`id`)
given that only two tables are involved.  But I could be wrong on that
one. :-)

Hope that helps.

Geoff


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to