Re: Update table with SQL

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I tried to type:
update TABLE1 set Column1 = (select count(*) from TABLE2
where([TABLE2].[Column2]=2))
Still without any success though...


"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:e8xj3hcxGHA.560@xxxxxxxxxxxxxxxxxxxxxxx
Access will interpret the quotes as a literal string, so the where clause
of
the query is comparing a literal string to a number.

Perhaps you want something like this:

update TABLE1 set Column1 =
(select count(*)
from TABLE2
where (Table2.Column2 = Table1.Column2));

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Roger Svensson" <roger.svensson@xxxxxxxxxxxxx> wrote in message
news:%23koZ3AcxGHA.4876@xxxxxxxxxxxxxxxxxxxxxxx

I have a SQL query that works fine on an SQL server database but not on
an
equivalent Access database. Can anyone please help me tune the query to
function in Access?
The query looks like this:

update TABLE1 set Column1 = (select count(*) from TABLE2
where("Column2"=2))




.