Jack Lauman wrote:
> Given the following query, how can it be modified to return 'Cuisine'(s)
> that have no rows as having a count of zero and also return a SUM of
> COUNT(*)?
> 
> SELECT w.WebsiteName, r.Cuisine, COUNT(*)
> FROM Restaurant r
> JOIN RestaurantWebsites w
> ON r.RestaurantID = w.RestaurantID
> WHERE w.WebsiteName = 'TOW'
> GROUP BY w.WebsiteName, r.Cuisine
> 
> Thanks.
> 
> Jack
> 
> 

After the where clause tack on:
HAVING COUNT(*)>0

This will eliminate the zero rows, but won't get you the sum.

I think the only way to get the sum is to either run a second query, or
to sum up the count column in your code as you're looping through the
results.

stipe42

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

Reply via email to