MySQL Forums
Forum List  »  Views

Help with comparing average with total...
Posted by: Karim Tabet
Date: November 17, 2010 09:25AM

Hi,

I've got a restaurant with a number of tables. I'm trying to get the average turnover of all the tables and list all the tables whos individual turnover is greater than the average turnover of all the tables.

Here's what I got so far...

SELECT table_no, postcode, AVG(total_amount) AS avg_turnover
FROM eatit_Restaurant JOIN eatit_Order ON postcode = branch
WHERE total_amount > avg_turnover
ORDER BY avg_turnover DESC;

But it wont run... Any suggestions?

Options: ReplyQuote


Subject
Views
Written By
Posted
Help with comparing average with total...
2687
November 17, 2010 09:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.