Solved

update query - join tables - aggregate function

Posted on 2011-09-20
2
410 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
append to an ms access field 6 26
ORA-00923: FROM keyword not found where expected 3 38
Documenting Data flow 4 6
mysql update statement 3 7
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now