Home » SQL & PL/SQL » SQL & PL/SQL » Group by on nested query
Group by on nested query [message #219142] Tue, 13 February 2007 02:50 Go to next message
alder
Messages: 2
Registered: February 2007
Junior Member
Hi all!
Can anyone help me?
My problem is a group by!
For example

select tabA.x , tabB.y, (select sum(tabC.z)....) as q
.
.
.
group by tabA.x , tabB.y, q

I obtain an error!
What's wrong ??

Thanks a lot!
Re: Group by on nested query [message #219149 is a reply to message #219142] Tue, 13 February 2007 02:59 Go to previous messageGo to next message
nksnare
Messages: 9
Registered: November 2006
Location: KL, Malaysia
Junior Member

HI, Use Following... i hope it gonna help u.

select tabA.x , tabB.y, sum(select sum(tabC.z)....)) as q
.
.
.
group by tabA.x , tabB.y


Regards,
Naresh
Re: Group by on nested query [message #219155 is a reply to message #219149] Tue, 13 February 2007 03:20 Go to previous messageGo to next message
alder
Messages: 2
Registered: February 2007
Junior Member
Thank you friend!
The error notification disappear! It's ok!
But i notice the q value seems to be the sum of the sum!
Is it possible?
It isn't the value i exepcted!

Thanks!
Re: Group by on nested query [message #219159 is a reply to message #219155] Tue, 13 February 2007 03:38 Go to previous message
nksnare
Messages: 9
Registered: November 2006
Location: KL, Malaysia
Junior Member

Hi, The Result is fine becuase your internal query will return one number and if u do sum of that it gonna be same all the time base on grouping (group by tabA.x , tabB.y).

select tabA.x , tabB.y, sum(select sum(tabC.z)....)) as q
.
.
.
group by tabA.x , tabB.y


Regards,
Previous Topic: varray(unable to print)
Next Topic: Help needed in building sql query
Goto Forum:
  


Current Time: Fri Dec 09 19:14:22 CST 2016

Total time taken to generate the page: 0.10766 seconds