Right now i'm just ordering all the rows by DESC, but i want to put the rows that are created the same day into groups and the groups in DESC.
This is what i currenly have:
$sql3 = "SELECT * FROM test3 WHERE aktiv LIKE 'Ja' ORDER BY date DESC ";
$result = mysqli_query($conn, $sql3);
So it will echo out all the rows that where created on 17 first then 16 and 14 into groups, then i can echo out the date of the different groups. So do i need to use GROUP BY or first find the dates then put it into groups.
I have tried different ways of doing it, but its so many different answers around and can't find the right solution for me, so i need a bit of help.
use aggregation function min for id and date for datetime to date
SELECT date(date) as day,aktiv,betvalue,min(id)
FROM test3 WHERE aktiv LIKE 'Ja' group by day,aktiv,betvalue
ORDER BY date(date) DESC