selecting unique values from a column
Solution 1:
Use the DISTINCT operator in MySQL:
SELECT DISTINCT(Date) AS Date FROM buy ORDER BY Date DESC;
Solution 2:
use
SELECT DISTINCT Date FROM buy ORDER BY Date
so MySQL removes duplicates
BTW: using explicit column names in SELECT
uses less resources in PHP when you're getting a large result from MySQL
Solution 3:
Use this query to get values
SELECT * FROM `buy` group by date order by date DESC
Solution 4:
The rest are almost correct, except they should order by Date DESC
SELECT DISTINCT(Date) AS Date FROM buy ORDER BY Date DESC;