Home » SQL & PL/SQL » SQL & PL/SQL » nested-group function/single-group function
nested-group function/single-group function [message #20246] Wed, 08 May 2002 13:06 Go to next message
Aysha Abrego
Messages: 1
Registered: May 2002
Junior Member
I'm trying to do a query like this:

SELECT s.Flt_Date, s.Flt_Nbr, s.Serial_Nbr,
COUNT(r.Cust_Nbr),
SUM(a.Capacity - COUNT(r.Cust_Nbr))
FROM Scheduled s,
Reserves r,
Planes p,
Aircraft_Type a
WHERE s.Sched_Flt = r.Sched_Flt AND
s.Serial_Nbr = p.Serial_Nbr AND
p.Type = a.Type
GROUP BY s.Flt_Date, s.Flt_Nbr, s.Serial_Nbr;

And I get 2 types of error messages: one says not a single-group function (referring to s.Flt_Date following SELECT) & says I should put it in a GROUP BY clause, which I thought I did at the end. The other message says Nested Group function without GROUP BY (referring to the second COUNT) and says I should add a GROUP BY, which I did at the end but does it mean to add another one somewhere else? Any help?
Re: nested-group function/single-group function [message #20256 is a reply to message #20246] Thu, 09 May 2002 03:57 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
SELECT s.Flt_Date, s.Flt_Nbr, s.Serial_Nbr,
COUNT(r.Cust_Nbr),
SUM(a.Capacity) - COUNT(r.Cust_Nbr)
FROM Scheduled s,
Reserves r,
Planes p,
Aircraft_Type a
WHERE s.Sched_Flt = r.Sched_Flt AND
s.Serial_Nbr = p.Serial_Nbr AND
p.Type = a.Type
GROUP BY s.Flt_Date, s.Flt_Nbr, s.Serial_Nbr;
Previous Topic: Ronald McDonald's initials please!
Next Topic: Finding Savepoints
Goto Forum:
  


Current Time: Tue Apr 16 03:41:48 CDT 2024