Home » SQL & PL/SQL » SQL & PL/SQL » help needed (sql,10ge,windows)
help needed [message #302171] Sun, 24 February 2008 08:15 Go to next message
dsa09
Messages: 7
Registered: February 2008
Junior Member
hi ppl i have a question to ask
i've the following sql query below but i want the output to be group as sum(price) but i'm just not able to do it, need some help over here

select diner,odate,serves.price from ordera3, serves where diner='JANUSZ' and odate='17-jan-2007';
Re: help needed [message #302175 is a reply to message #302171] Sun, 24 February 2008 09:54 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
1/ please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
2/ '17-jan-2007' is not a date but a string
3/ Explain which sum you want, group by what
4/ Post what you already tried to find this sum

Regards
Michel
Re: help needed [message #302190 is a reply to message #302171] Sun, 24 February 2008 15:37 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you want to sum prices, why don't you do that? Where's the SUM function? Try to use it and run the query. IT will probably fail, but Oracle error might give you a hint what to do next.

Also, it would probably be a good idea to read documentation about the SUM function and GROUP BY clause.
Re: help needed [message #302205 is a reply to message #302171] Sun, 24 February 2008 21:41 Go to previous messageGo to next message
dsa09
Messages: 7
Registered: February 2008
Junior Member
select diner,odate,SUM(serves.price) from ordera3, serves where diner='JANUSZ' and odate='14-jan-2007';

It gives me an error " ORA-00937: not a single-group group function "

Re: help needed [message #302207 is a reply to message #302171] Sun, 24 February 2008 21:56 Go to previous messageGo to next message
dsa09
Messages: 7
Registered: February 2008
Junior Member
SQL> select diner,odate,sum(serves.price) from ordera3, serves where diner='JANU
SZ' and odate='14-jan-2007';
select diner,odate,sum(serves.price) from ordera3, serves where diner='JANUSZ' a
nd odate='14-jan-2007'
*
ERROR at line 1:
ORA-00937: not a single-group group function
Re: help needed [message #302208 is a reply to message #302171] Sun, 24 February 2008 21:58 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
As Littlefoot said:
Also, it would probably be a good idea to read documentation about the SUM function and GROUP BY clause.
Re: help needed [message #302231 is a reply to message #302207] Mon, 25 February 2008 00:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Also read again the fisrt 3 points I gave and try to follow them.

Regards
Michel
Re: help needed [message #302287 is a reply to message #302171] Mon, 25 February 2008 03:23 Go to previous messageGo to next message
dsa09
Messages: 7
Registered: February 2008
Junior Member
i manage to get it to work
Re: help needed [message #302324 is a reply to message #302287] Mon, 25 February 2008 04:30 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It would be nice if you post the code so that other forum members might benefit from it.
Previous Topic: How do I fire trigger with sequnce value condition?
Next Topic: Substitution variable into a procedure (merged)
Goto Forum:
  


Current Time: Tue Feb 18 10:50:46 CST 2025