How to get a unique date list from my db in PHP?

there are 5 fields in my db (id, list_date, amount, total, m_from)

and contain data, for example:

1 - 1/1/2010 - 10 - 50 - 'example111'

1 - 1/1/2010 - 10 - 50 - 'example111'

1 - 1/4/2010 - 10 - 50 - 'example154

1 - 1/1/2010 - 10 - 50 - 'example111'

1 - 1/5/2010 - 10 - 50 - 'test'

I need to know how I can get dates from list_date, but without duplicate dates like '1/1/2010, 1/5/2010, 1/4/2010'

Thanks at Advance.

+3
source share
2 answers
SELECT DISTINCT list_date FROM table
+3
source

If I'm not mistaken, you can also use GROUP BY:

SELECT list_date FROM table GROUP BY list_date
0
source

Source: https://habr.com/ru/post/1750060/


All Articles