M
M
McMike2017-04-07 12:25:00
PostgreSQL
McMike, 2017-04-07 12:25:00

How to write a query that will select the amount for each position?

Either I'm tired already in the evening, I can't figure it out))
There is a table of users, id, registration_date
It is necessary to take the number of users who registered before it for each date.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2017-04-07
@McMike

Use window functions

select
  distinct(registration_date),
  count(*) over (order by registration_date) as registered
from users
order by registration_date;

A
Axian Ltd., 2017-04-07
@AxianLTD

select count where ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question