🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.sqlinfo
Article #227

Sub-query error

#227
From: Dan Matthews
Date: Sat, 05 Aug 2000 00:00
15 lines
1357 bytes
Hi.
Could someone do me a favour and tell me what is wong with the query below.
When I try and run it, it complains abou the ID field not being part of an
aggregate function.

Select a.name as Team, b.total - a.penalty as TeamTotal
from
(select v.name as name ,v.penalty as penalty ,v.id as id from VF1Team as v)
as a,
(select v1.name as name , sum(r.points) AS total , v1.id as id from VF1Team
as v1 ,TeamPicks as t ,Driver as d ,RaceResults as r where v1.id = t.teamid
and t.driverid = d.id and d.id = r.driverid group by v1.name) as b
where a.id = b.id
order by TeamTotal
DESC;
Technical Details
Message-ID: <8mfr19$mi9$1@newsg2.svr.pol.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1131db,58664d195145cb11,start
X-Google-Attributes: gid1131db,public
X-Google-Thread: 11355a,58664d195145cb11,start
X-Google-Attributes: gid11355a,public
From: "Dan Matthews" <dan@grandprix.freeserve.co.uk>
Subject: Sub-query error
Date: 2000/08/05
Message-ID: <8mfr19$mi9$1@newsg2.svr.pol.co.uk>
X-Deja-AN: 654635615
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300
X-Complaints-To: abuse@theplanet.net
X-Trace: newsg2.svr.pol.co.uk 965439337 23113 62.136.196.141 (5 Aug 2000 01:35:37 GMT)
Organization: Customer of Energis Squared
X-MSMail-Priority: Normal
NNTP-Posting-Date: 5 Aug 2000 01:35:37 GMT
Newsgroups: bit.listserv.sqlinfo,mailing.database.sql-general