A
A
aminodovborisov2021-09-22 11:28:03
SQL
aminodovborisov, 2021-09-22 11:28:03

How to write a SQL query like "Client - first connection"?

Hello! I guess that the request is simple, but my head is still empty...
There is a users table, which displays the user and the date of his connection to the conditional service. Some users may connect to this service every day:

userid					conndate
1						2021-09-01
2						2021-09-01
3						2021-09-01
4						2021-09-01
1						2021-09-02
2						2021-09-02
5						2021-09-02
3						2021-09-03
4						2021-09-03
6						2021-09-03


I want to make a query that will result in two fields:
1. Unique user
2. Date of the first (!) connection of this unique user.
That is, like this:

userid					conndate
1						2021-09-01
2						2021-09-01
3						2021-09-01
4						2021-09-01
5						2021-09-02
6						2021-09-03


Can you please tell me how this request should look like?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-09-22
@aminodovborisov

MIN(), GROUP BY

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question