By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Update query with aggregate function question

P: 2
Using MS Access 2002/XP I am trying to create an update query which will count the number of times a particular item has been referenced in another table and store that value in the first table. For example, tableA lists individuals tableB contains 0 to many references to each individual in tableA. I would like a field in tableA that contains the number of times that particular record has been referenced in tableB.

I have tried the following query, but get an error about inappropriate use of brackets.

UPDATE tableB inner join [SELECT tableA.ID, Count(tableA.ID as count from tableA GROUP BY tableA.ID] on tableB.ID = [SELECT tableA.ID, Count(tableA.ID as count from tableA GROUP BY tableA.ID].ID
SET Count= [SELECT tableA.ID, Count(tableA.ID as count from tableA GROUP BY tableA.ID].count;

Any help on this matter would be greatly appreciated.

Thanks.
Oct 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: 5
UPDATE tableB inner join [SELECT tableA.ID, Count(tableA.ID as count from tableA GROUP BY tableA.ID] on tableB.ID = [SELECT tableA.ID, Count(tableA.ID as count from tableA GROUP BY tableA.ID].ID
SET Count= [SELECT tableA.ID, Count(tableA.ID as count from tableA GROUP BY tableA.ID].count;
You might try

UPDATE tableB inner join [SELECT tableA.ID, Count(aID as count(tableA.ID) GROUP BY tableA.ID]

I am not sure you can mix aggregate and non-aggregate fields in a single query in Access, however.
Oct 12 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.