Re: Update table with SQL
- From: "Roger Svensson" <roger.svensson@xxxxxxxxxxxxx>
- Date: Tue, 22 Aug 2006 16:59:28 +0200
Thanks John! You made my day...
Where can I get a good overview of those "hidden" Access functions? There
seems to be a lot of them...
/Roger
"John Spencer" <spencer@xxxxxxxxx> wrote in message
news:eFLHzpexGHA.2264@xxxxxxxxxxxxxxxxxxxxxxx
How about using the DCount function? Access won't allow you to useclause
aggregate queries in an update query (other than in a where clause).
UPDATE TABLE1
SET Table1.Column1 =DCount("*","Table2","Column2 = 2")
"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:e8xj3hcxGHA.560@xxxxxxxxxxxxxxxxxxxxxxx
Access will interpret the quotes as a literal string, so the where
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))
.
- References:
- Update table with SQL
- From: Roger Svensson
- Re: Update table with SQL
- From: Allen Browne
- Re: Update table with SQL
- From: John Spencer
- Update table with SQL
- Prev by Date: Re: help...new to queries
- Next by Date: Re: Queries involving subforms
- Previous by thread: Re: Update table with SQL
- Next by thread: Re: Update table with SQL
- Index(es):
Relevant Pages
|
Loading