dummyagain
November 30th, 2004, 01:00 AM
i get a transaction table with sub_quantity, bookid, and a book table with bookid...etc
i want to get the top ten books by adding up the sub_quantity of each book.
say there are 3 transactions
1 ASP 10 (quantity)
2 PHP 10
3 ASP 10
4 MYSQL 4
5 PHP 6
i write to show the ranking of the sold book.....by writing
SELECT b.name from book as b, transaction as t order by t.sub_quantity desc limit 10;
the query gets a problem of not adding up the price to rank...and so the result is the one i want....
can anyone tell me how to edit this query?
thanks
i want to get the top ten books by adding up the sub_quantity of each book.
say there are 3 transactions
1 ASP 10 (quantity)
2 PHP 10
3 ASP 10
4 MYSQL 4
5 PHP 6
i write to show the ranking of the sold book.....by writing
SELECT b.name from book as b, transaction as t order by t.sub_quantity desc limit 10;
the query gets a problem of not adding up the price to rank...and so the result is the one i want....
can anyone tell me how to edit this query?
thanks