Home » SQL & PL/SQL » SQL & PL/SQL » Syntax help
Syntax help [message #199358] Mon, 23 October 2006 14:54 Go to next message
fmbamalu
Messages: 4
Registered: October 2006
Location: TEXAS
Junior Member
Hello guys, i want to show inv_number, inv_amount, inv_type, and the Total (inv_price*inv_qoh) from the INVENTORY table.
Any help?

This is what i did so far.


SELECT SUM(Inv_Price*Inv_qoh)
From Inventory
Group By Inv_id ,Inv_price ,Inv_qoh

[Updated on: Tue, 24 October 2006 10:10]

Report message to a moderator

Re: Syntax help [message #199359 is a reply to message #199358] Mon, 23 October 2006 15:01 Go to previous messageGo to next message
BlackSwan
Messages: 25032
Registered: January 2009
Location: SoCal
Senior Member
>Any help?
NO, the homework tutor is down the hall & 2nd door on left.
Why is this posted in a PL/SQL Expert forum; as opposed to Beginner SQL?
Re: Syntax help [message #199404 is a reply to message #199359] Tue, 24 October 2006 01:27 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Hey fmbamalu, tell you what: why don't you show us what you have tried so far. We'll help you out from there. Deal?

MHE
Re: Syntax help [message #199466 is a reply to message #199404] Tue, 24 October 2006 10:14 Go to previous messageGo to next message
fmbamalu
Messages: 4
Registered: October 2006
Location: TEXAS
Junior Member
Hello Maaher, i am NOT a student as you said.I work for a small company and new to SQL and to this site. I just took over from our DBA that quit recently. I was originally a peoplesoft application support.
Anyway. Just for your info.

[Updated on: Tue, 24 October 2006 13:04]

Report message to a moderator

Re: Syntax help [message #199471 is a reply to message #199466] Tue, 24 October 2006 11:03 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Too bad Maaher never said you were a student...
But Maaher is right. You will never learn anything by just asking questions. You learn most by trying.
When you're stuck, please come back and show us you put some effort in it as well, instead of just asking us, and we all will be glad to help you out.
Re: Syntax help [message #199478 is a reply to message #199404] Tue, 24 October 2006 13:06 Go to previous messageGo to next message
fmbamalu
Messages: 4
Registered: October 2006
Location: TEXAS
Junior Member
I modified my message to show what i did already.
Re: Syntax help [message #199493 is a reply to message #199478] Tue, 24 October 2006 15:13 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps it would be better if you wrote that query in a new post; it is kind of difficult to notice what you did when you modify the initial post a day after it was created. OK, never mind that.

Using SQL*Plus, and if I understood you correctly, this could be done as follows:
compute sum of price_qoh on dummy
column dummy noprint
break on dummy

select inv_number, inv_amount, inv_type, inv_price * inv_qoh price_qoh,
  null dummy
from inventory;
Re: Syntax help [message #199547 is a reply to message #199466] Wed, 25 October 2006 01:36 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
fmbamalu wrote on Tue, 24 October 2006 17:14
Hello Maaher, i am NOT a student...
Good for you! Although being a student isn't bad. I kind of liked my student days.
fmbamalu wrote on Tue, 24 October 2006 17:14
...as you said.
But you're barking up the wrong tree...

Now as for your question: you want (inv_price*inv_qoh), inv_number, inv_amount and inv_type. I think you were on the right track with your group by:
SELECT inv_number
     , inv_amount
     , inv_type
     , (inv_price*inv_qoh) total
FROM   yourtable
GROUP BY inv_number
       , inv_amount 
       , inv_type

Is this what you were after? If not, check out the tips and tricks (first thread here, the so called "sticky") and try to provide a little bit more information.

MHE
Previous Topic: Validating a DDL before execution
Next Topic: How to take data from two table.
Goto Forum:
  


Current Time: Fri Dec 02 12:12:38 CST 2016

Total time taken to generate the page: 0.08392 seconds