List:General Discussion« Previous MessageNext Message »
From:Philip Mather Date:December 29 2006 4:44pm
Subject:Re: Count the number of specific rows
View as plain text  
Servers24,
> Hi Philip,
>  
> Thank you very much for your help.
> Can you please tell me the differemce between COUNT(*) and COUNT(id) ?
> Thanks again.
Actually sorry I was a bit misleading there. MySQL is optimized to 
calculate...
    SELECT COUNT(*) FROM aTable;
...but given the fact you've got a where condition that optimizations 
probably no longer applicable, so I'd stick with...
    SELECT COUNT(id) FROM sent WHERE member_id = ...;
...the real difference would be when you do a SELECT COUNT(DISTINCT id) 
instead of a SELECT COUNT(DISTINCT *) which are different questions but 
not relevant to your situation.

Regards,
    Phil
Thread
Count the number of specific rowsServers24 Network29 Dec
  • Re: Count the number of specific rowsDuncan Hill29 Dec
  • Re: Count the number of specific rowsPhilip Mather29 Dec
  • Re: Count the number of specific rowsPeter Brawley29 Dec
Re: Count the number of specific rowsPhilip Mather29 Dec