Home > database >  Consult an SQL statement follows the efficient way
Consult an SQL statement follows the efficient way

Time:02-07

I have a table, inside have 5 million records

ID name user_Id valid_date
Aaaa 1 2021-02-06
2 aaaa 1 2021-02-06
3 BBB 1 2021-02-07
4 CCCC 1 2021-02-08
5 aaaa 2 2021-02-06

Please find out from the current time each user valid_date one of the most recent record list, the results are as follows:
ID name user_Id valid_date
Aaaa 1 2021-02-06
Aaaa 2 2021-02-06


Need to consider performance! Need an SQL statement to achieve

  • Related