-2

I have a table with 3 columns: id (PK), name, date

I only have 3 different names but the table is +1k records. So I need to get those 3 names ordered by date desc. But when I use the DISTINCT clause it brings all because the date are different.

I use a query like this:

SELECT DISTINCT (T.NAME) , T.DATE
    FROM TABLE1 T JOIN TABLE2 S ON T.ID = S.ID
   WHERE S.ROL = 3
ORDER BY T.DATE DESC;

dataa

MT0
  • 113,669
  • 10
  • 50
  • 103

0 Answers0