Solved

update query - join tables - aggregate function

Posted on 2011-09-20
2
415 Views
Last Modified: 2012-05-12
I need to do something like this:

UPDATE t1, t2
SET t1.field = AVG(t2.field)
WHERE t1.key = t2.key

of course I get the error:
"Invalid use of group function"

Any Ideas?
0
Comment
Question by:arielbf
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 36565860
Update t1

set t1.field = ( select AVG(t2.field) from t2 WHERE t1.key = t2.key )
0
 

Author Closing Comment

by:arielbf
ID: 36565894
Perfect, Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question