I have these table in my database:
id Name Order Date
1 A 29-Dec
2 B 15-Dec
3 C 12-Oct
4 A 15-Dec
5 B 15-Sep
6 A 15-Sep
7 B 15-Aug
8 C 15-Aug
9 A 15-Jul
Expected Output:-
Name QTY Last Order Date
A 4 29-Dec
B 3 15-Dec
C 2 12-Oct
How to do this, Please help.
Also I have to select only those record whose last order date is greater than 10 days.
The purpose behind this query is to send such customer a notification who are not ordering since 10 days. How to do this, Please help...