MySQL Forums
Forum List  »  Newbie

Re: What's difference between "SELECT COUNT(column_1) new_count" vs. "SELECT COUNT(*) new_count"?
Posted by: Mike M
Date: March 12, 2021 12:49PM

Hi Peter,

I want to count the number of channels (column w.channel) by each group: direct, indirect, others.

I'm told to do this as the solution:
SELECT s.name, w.channel, COUNT(*) num_events

To me, it is doing a rowcount of the entire table. That's not correct! It should be doing "COUNT(w.channel) num_events", because it's asking for w.channel column count. Why involve the entire table into it?

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
Re: What's difference between "SELECT COUNT(column_1) new_count" vs. "SELECT COUNT(*) new_count"?
March 12, 2021 12:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.