: Tuesday, September 26, 2006 7:15 AM
To: Robert DiFalco
Cc: mysql@lists.mysql.com
Subject: Re: Updating two fields from an aggregate query
Robert, you might give "insert ... select ... on duplicate key update" a
try:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
something
L PROTECTED]
Sent: Tuesday, September 26, 2006 7:15 AM
To: Robert DiFalco
Cc: mysql@lists.mysql.com
Subject: Re: Updating two fields from an aggregate query
Robert, you might give "insert ... select ... on duplicate key update" a
try:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
som
Robert, you might give "insert ... select ... on duplicate key update" a try:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
something like this (untested):
INSERT INTO parent (id, maxChildAge, childCount)
SELECT parentid, MAX(age) as maxAge, COUNT(*) as ct
FROM child
WHERE parentid I