Syntax for order by and group by in query report

hi everyone,
Can anyone please share the syntax of order by and group by in sql query report…
Regards Sakshi

Hi @Sakshi_Choudhary

Here’s a sample group by and order by query for Items DocType

select * from tabItem group by item_group order by creation

If you could describe in detail what you’re trying to achieve a more specific query can be written.

Thank you for the response
I want to create report for the doctype and I want last order date of a customer but i got all dates from the doctypes of same customer ,so I want to use first order by then group by ,but this works opposite like first group by is working then order by in python…
so I want to achieve this problem from sql query

select * from tabOrder group by customer_id order by creation desc

SyntaxError: invalid syntax
this is giving me syntax error