Use the DISTINCT operator in MySQL:
SELECT DISTINCT(Date) AS Date FROM buy ORDER BY Date DESC;
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
SELECT
Use this query to get values
SELECT * FROM `buy` group by date order by date DESC