Thread: Mysql question
View Single Post
Old 11-01-2010, 02:18 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,110
Quote:
Originally Posted by BCyber View Post
I'm stuck on this problem What am I doing wrong? I need it to show all the book types with their average prices.

For each type of book, list the book type and the average price. Only include paperback books.

mysql> SELECT TYPE, AVG(PRICE)
-> FROM BOOK
-> WHERE PAPERBACK = 'Y';
+------+------------+
| TYPE | AVG(PRICE) |
+------+------------+
| SFI | 10.664348 |
+------+------------+
1 row in set (0.00 sec)
Select type, avg(price) from book where paperback='Y' group by type
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote