V
V
Vanya Huk2018-04-03 04:00:32
PostgreSQL
Vanya Huk, 2018-04-03 04:00:32

Why does count always return 1?

Why does count together with group by always return 1?

select count(*) as aggregate from "products" group by "products"."id"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad_fox, 2018-04-03
@vanyahuk

What information would you like to receive with a request?

S
Stalker_RED, 2018-04-03
@Stalker_RED

Probably because id is a unique field, and when grouping, exactly one is obtained.
But this is not accurate (you did not show what kind of plate you have).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question