This may get you started if I understand the problem correctly.
update table1
set field1 = (select count(*)
from table2
were table2.id = table1.id)
Ray Thompson
Tau Beta Pi (www.tbp.org)
The Engineering Honor Society
865-546-4578
-----Original Message-----
From: Scott Weikert [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 06, 2006 1:07 PM
To: SQL
Subject: Re: sub-select with an aggregate
I've got a similar situation, but it's with an UPDATE, not a SELECT.
I've got two tables - both have a particular ID field, the first table
also has an INT field.
I'm trying to write a query that will update the INT field in the first
table with the count of matching records in the second table, using the
ID field in both to match. No luck as yet.
I was hoping this thread's solution would help, but it's a rather
different issue. :(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2460
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54