Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
capriman
Starting Member
4 Posts |
Posted - 2011-12-10 : 06:48:15
|
SELECT b.ISBN,sum(o.quantity) as TOTALQTYSold,avg((RETAIL-COST)/COST*100) AS PERcentPROFITFROM BOOKS b, orderitems oWHERE b.isbn=o.isbngroup by b.isbnorder by TOTALqtysold desc;here is my sql but need to only show the Top 5 Isbn and the rest of the columns for the top 5 quantity sold books????thanks,capriman |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-10 : 07:09:49
|
[code]SELECT TOP 5 b.ISBN,sum(o.quantity) as TOTALQTYSold,avg((RETAIL-COST)/COST*100) AS PERcentPROFITFROM BOOKS b, orderitems oWHERE b.isbn=o.isbngroup by b.isbnorder by TOTALqtysold desc;[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
capriman
Starting Member
4 Posts |
Posted - 2011-12-10 : 07:37:28
|
getting an error on line 2 for some reason with the suggested code??I am using SQL developer to do this??thanks |
|
|
|
|
|