Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with nested Select 1

Status
Not open for further replies.

Lekar

Programmer
Sep 7, 2001
85
0
0
CR
Select C1, C2, C3, (Select Sum(ColSum1)
From PAYS P
Where P.F1 = C.F1
And P.F2 = C.F2) As TotalPay
From Client C
Where ToPay <> (Select Sum(ColSum1)
From PAYS P
Where P.F1 = C.F1
And P.F2 = C.F2)
Order By C1 Asc, C2 Asc

When I run the previous Select I get this error:
ORA-00979: not a GROUP BY expression

If I comment any nested Select it works. I wanna know if it is possible to use both nested Select

Thanks.

[bomb]
 

Convert to a simple join:

Code:
Select C1, C2, C3, S.Totalpay
  From Client C
     ,(Select F1, F2, Sum(Colsum1) Totalpay
         From Pays P
        Group By F1, F2) P 
 Where P.F1 = C.F1
   And P.F2 = C.F2
   And C.Topay <> P.Totalpay
 Order By C1 Asc, C2 Asc
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top