Home » RDBMS Server » Server Administration » count in an update query
count in an update query [message #373276] Mon, 09 April 2001 10:04
Sami Romdhani
Messages: 1
Registered: April 2001
Junior Member
Hi,

I would like to update field_1 in table_1 based on the number of records in table_2 whose foreign_key field is joined to table_1's primary_key field. So, I'm doing this with the following query :

UPDATE table_1 SET field_1 = (SELECT Count(*) FROM table_2 INNER JOIN table_1 ON table_1.primary_key=table_2.foreign_key);

Unfortunately this does not work and MS Access' error message is :
Operation must use an updateable query.

Note that when my query is :
UPDATE table_1 SET field_1 = 1;
this operation is succesfully executed.

Any idea to solve this problem would be greatly appreciated.

Thanks, Sami.
Previous Topic: Insert into long column
Next Topic: SQL
Goto Forum:
  


Current Time: Mon Jul 01 11:14:59 CDT 2024