RE: Updating two fields from an aggregate query

2006-09-26 Thread Robert DiFalco
: 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

Re: RE: Updating two fields from an aggregate query

2006-09-26 Thread Dan Buettner
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

Re: Updating two fields from an aggregate query

2006-09-26 Thread Dan Buettner
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