Jack Lauman wrote:

I have the following query which display every Cuisine in the database sorted by the WebsiteName.

How can I modify this to get a COUNT of the number of records in each Cuisine in each WebsiteName?


SELECT DISTINCT Restaurant.Cuisine, RestaurantWebsites.WebsiteName
FROM Restaurant
INNER JOIN RestaurantWebsites ON ( Restaurant.RestaurantID = RestaurantWebsites.RestaurantID )
WHERE RestaurantWebsites.WebsiteName = 'TOS'
ORDER BY Cuisine ASC
LIMIT 0 , 300

Thanks

Jack

Something like

  SELECT w.WebsiteName, r.Cuisine, COUNT(*)
  FROM Restaurant r
  JOIN RestaurantWebsites w
    ON r.RestaurantID = w.RestaurantID
  WHERE w.WebsiteName = 'TOS'
  GROUP BY w.WebsiteName, r.Cuisine;

should do, if I understand the question.

Michael


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to