Article View: bit.databases.mssql-l
Article #194UPDATE with SUM = possible??
From: AGP
Date: Sat, 27 Apr 2002 03:36
Date: Sat, 27 Apr 2002 03:36
16 lines
2154 bytes
2154 bytes
I am trying to update a field1 in table1 with the sum of a field2 in table2. the two tables are related through dbID. There is a unique dbID in table1 that corresponds to many dbID's in table2. I cant seem to get a SUM statement to work in an UPDATE statement. My statement looks like so: UPDATE table1, table2 SET table1.field1 = SUM(table2.field2) WHERE (table1.dbID = table2.dbID); I get an error that says i tried to execute a query that does not include field1 as part of an aggregate function. what am i doing wrong and how can i fix it. tia AGP
Technical Details
Message-ID:
<p1py8.76489$HH5.4608@rwcrnsc51.ops.asp.att.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 104586,abdb81538e97caf8,start X-Google-Attributes: gid104586,public X-Google-Thread: 105516,abdb81538e97caf8,start X-Google-Attributes: gid105516,public X-Google-Thread: 10be7f,abdb81538e97caf8,start X-Google-Attributes: gid10be7f,public X-Google-Thread: 103bcf,abdb81538e97caf8,start X-Google-Attributes: gid103bcf,public X-Google-Thread: f6611,abdb81538e97caf8,start X-Google-Attributes: gidf6611,public X-Google-ArrivalTime: 2002-04-26 20:36:54 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Reply-To: "AGP" <sindizzy.pak@softhome.net> From: "AGP" <sindizzy.pak@softhome.net> Newsgroups: bit.databases.mssql-l,microsoft.public.ado,microsoft.public.ado.rds,microsoft.public.vb.database,microsoft.public.vb.database.dao Subject: UPDATE with SUM = possible?? Lines: 20 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <p1py8.76489$HH5.4608@rwcrnsc51.ops.asp.att.net> NNTP-Posting-Host: 12.238.234.178 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1019878613 12.238.234.178 (Sat, 27 Apr 2002 03:36:53 GMT) NNTP-Posting-Date: Sat, 27 Apr 2002 03:36:53 GMT Organization: AT&T Broadband Date: Sat, 27 Apr 2002 03:36:53 GMT