What is the difference between "select count(*) from sometable" and "select count(somefield) from sometable"? The answer is simple, the "count(*)" will count all the record on that table. The "count(somefield)" will count all the record which is that field is not null. So the result of that 2 query may different. Example:
I have a table foo which has the record like this:
id name1 XXXXX2 YYYYY3 4 select count(*) as cntall, count(name) as cntname from foo
The result of the above query is:
cntall cntname4 2
Tidak ada komentar:
Posting Komentar