Hi , This is a little off topic but I have seen count(*) on this list afew times and it got me wondering...
Is there a reason to use SELECT COUNT(*) as opposed to SELECT COUNT(column)? I have noticed that selecting count(*) versus specifying the column name executes much more slowly. I've been around, on relative periphery, SQL and SQL DBMS' for a long time but never seen count(*) used. These days I am more involved with SQL (using MySQL) and want to learn more nuances as I go along. Cheers and thanks in advance, Nic On 7/16/05, stipe42 <[EMAIL PROTECTED]> wrote: > 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] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]