Hi,
I have a data set. Now I want to perform a query that will show me some specific fields as well as the total number of results with count()
I tried this:
select count(s.id), s.id, s.unit_factor from test
as s
But it is giving me error: Expression must be a group key or aggregate: (s
.id
)
Then I tried this: select count(s.id), s.id, s.unit_factor from test
as s group by s.id
Now it’s giving error for s.unit_factor field
What is the solution? Should I need to group by all the fields that I query in the select statement?