How to use GROUP BY
along with ORDER BY
? I need to sort my tabela
form ASC
but I can not use GROUP BY
how should I do to use the two together?
code snippet:
mysqli_query($conn, "SELECT nome_fotos, img, id_cliente FROM alboom WHERE id_fot = '$getid' GROUP BY id_cliente ORDER BY id ASC");
This is my code, but it does not sort the photos.
the result after the query in the workbench was
name_photos = merry img = merry.jpg customer_id = 2
or it did not order because I have id = 1 in the database.