Need some Oracle SQL help

Tikerz

Golden Member
Oct 9, 1999
1,272
0
76
Here's the query I have now:

select quantity, title, round((cost/retail*100),0) "% Profit"
from orders natural join orderitems natural join books
where (cost/retail*100) < 55;

Here's the output:

QUANTITY TITLE % Profit
-------- ------------------------------ ----------
1 HOW TO MANAGE THE MANAGER 48
1 PAINLESS CHILD-REARING 53
2 PAINLESS CHILD-REARING 53
1 SHORTEST POEMS 55
1 PAINLESS CHILD-REARING 53
1 PAINLESS CHILD-REARING 53
1 PAINLESS CHILD-REARING 53

How do I get it look like this?

QUANTITY TITLE % Profit
-------- ------------------------------ ----------
1 HOW TO MANAGE THE MANAGER 48
6 PAINLESS CHILD-REARING 53
1 SHORTEST POEMS 55


Thank you in advance for any help!
 

Tikerz

Golden Member
Oct 9, 1999
1,272
0
76
Originally posted by: ajpa123
aggregates and order bys

You mean aggregate functions and the group by clause? I thought so, but I don't think I'm using them right. Not sure where to start.