Share via

SQL - count (*)

Franck Nsungu Lukanda 86 Reputation points
2022-03-16T13:56:12.277+00:00

Hello,

Here is my sql query:

select last_name, first_name
count (*)
from actor
group by last_name,
first_name
order by 3 desc

When running it I have an syntax error message around "count (*)":

LINE 2: count (*)
^
SQL state: 42601
Character: 37

Can you please help me? Thanks!

Azure Database for PostgreSQL
0 comments No comments

Answer accepted by question author

GeethaThatipatri-MSFT 29,597 Reputation points Microsoft Employee Moderator
2022-03-16T18:04:07.97+00:00

Hi, @Franck Nsungu Lukanda Welcome to Microsoft Q&A Thanks for posting your query.
Can you please try as below, comma is missing after first_name.

select last_name, first_name,
count (*)
from actor
group by last_name,
first_name
order by 3 desc

Regards
Geetha

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Franck Nsungu Lukanda 86 Reputation points
    2022-03-17T08:41:23.977+00:00

    Hi @GeethaThatipatri-MSFT , it works.
    Thanks for the explanation!

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.