Hello,
I'm selling sandwiches online and I'm trying to create a asp page where I can review my sales and found out who is my best customers and so on...
My table (CUSTOMERS) lists the number of times a same customer ordered (ORDERS) and the total amount of money he spent (SALES).
Now, I'd like to calculate my customer's average spending : SALES divided by ORDERS.
sql="SELECT * FROM CUSTOMERS ORDER BY SALES/ORDERS ASC"
This is my sql statement and of course, it doesn't work, please help me.
- I prefer not adding another column in my database cause it's already huge enough.
- I need to calculate the average in the sql so that I can order my results ascending or descending.
Thank you!
I'm selling sandwiches online and I'm trying to create a asp page where I can review my sales and found out who is my best customers and so on...
My table (CUSTOMERS) lists the number of times a same customer ordered (ORDERS) and the total amount of money he spent (SALES).
Now, I'd like to calculate my customer's average spending : SALES divided by ORDERS.
sql="SELECT * FROM CUSTOMERS ORDER BY SALES/ORDERS ASC"
This is my sql statement and of course, it doesn't work, please help me.
- I prefer not adding another column in my database cause it's already huge enough.
- I need to calculate the average in the sql so that I can order my results ascending or descending.
Thank you!
Comment