473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UPDATE SET xxx=SELECT Help

Hello everyone,

I'm quite new to ACCESS and I have a fairly good knowledge of SQL under
Oracle. I'm trying to run the following query without any luck:

UPDATE M1L
SET M1L.Code_err = (SELECT M1.Code_err
FROM table_temp M1
WHERE M1L.Forme=M1.Forme
AND M1L.PdeD=M1.PdeD
AND M1.Code_Err is not null);
Access gives me a strange error message about not being to update something
with something (I run a French Office) and it's too late for a good
translation. I'm puzzled. Does Access support that kind of query? If not, is
there a work around?

Thanks,
Patrick


Nov 12 '05 #1
2 23439
The closest thing I could come up with that appears to be what you have is

UPDATE M1L INNER JOIN M1 ON (M1L.PdeD = M1.PdeD) AND (M1L.Forme = M1.Forme)
SET M1L.Code_err = [M1].[Code_err]
WHERE ((Not (M1.Code_err) Is Null));

The only problem I see with this is that if M1 has more than one value that meets all 3
criteria, the last one that the query comes to will be the one finally stored in M1L.

Example:
M1.PdeD = A, M1.Forme = B, M1.Code_err = 1
M1.PdeD = A, M1.Forme = B, M1.Code_err = 2

M1L.PdeD = A, M1L.Forme = B, M1L.Code_err = 3

When done, do you want 3 to become 1 or 2? It will depend on the sort order in the query,
the one it comes to last will be the new value in place of 3. The data in your table may
be such that this isn't a problem.

--
Wayne Morgan
"Patrick Drouin" <pa************@uREMOVE-THISmontreal.ca> wrote in message
news:fB*********************@charlie.risq.qc.ca...
Hello everyone,

I'm quite new to ACCESS and I have a fairly good knowledge of SQL under
Oracle. I'm trying to run the following query without any luck:

UPDATE M1L
SET M1L.Code_err = (SELECT M1.Code_err
FROM table_temp M1
WHERE M1L.Forme=M1.Forme
AND M1L.PdeD=M1.PdeD
AND M1.Code_Err is not null);
Access gives me a strange error message about not being to update something
with something (I run a French Office) and it's too late for a good
translation. I'm puzzled. Does Access support that kind of query? If not, is
there a work around?

Thanks,
Patrick

Nov 12 '05 #2
Hello Wayne,

"Wayne Morgan" <co***************************@hotmail.com> a écrit dans le
message de news:iU*****************@newssvr16.news.prodigy.co m...
The closest thing I could come up with that appears to be what you have is

UPDATE M1L INNER JOIN M1 ON (M1L.PdeD = M1.PdeD) AND (M1L.Forme = M1.Forme) SET M1L.Code_err = [M1].[Code_err]
WHERE ((Not (M1.Code_err) Is Null));

The only problem I see with this is that if M1 has more than one value that meets all 3 criteria, the last one that the query comes to will be the one finally

stored in M1L.

Thanks, I'll give that a try and see if it works. I don't really mind if
more than one value matches since if I get a value the record will be
scraped regardless of the content. I didn't think of using INNER JOIN to do
that, not a bad idea at all. I like subqueries a lot better though. ;o)

Ciao and thanks again!
P
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paul Eden | last post by:
Hello all. I'm totally stumped. Please de-stump me! I've read my data in from the database, changed it according to what i want to do and now I want to write it back. But it seems I can only...
1
by: MattMika | last post by:
I am trying to integrate a Credit Card # deletion option into Batch_print_center and need some help. Batch_print_center has a form where you specify orders you want to print or proccess by...
7
by: Steve B. | last post by:
Does anyone know why the DA Update() would throw an exception? I moved the database but I updated the Conn and the DA, currently (trying)removing/replacing DS. Is there a another direction I...
0
by: Ash | last post by:
Hi, I'm using Vb.NET webform, connecting to sql server database on the local machine. I used datagrid propery builder to add the edit, update and cancel colum. On the code, i have: Private...
4
by: Mike | last post by:
I have an update page and on the page there are sometimes names with 's (car's) in it When I try to update it i get a syntax error. How can i update the record with a 's (car's) in the name? thx
5
by: parwal.sandeep | last post by:
Hello grp! i'm using INNODB tables which are using frequently . if i fire a SELECT query which fetch major part of table it usually take 10-20 seconds to complete. in mean time if any UPDATE...
2
by: billr | last post by:
SQL newby in deep water thats way over my head. Any help appreciated. I am trying to retrieve data from field in one table and append it to on field in a second table. Each the fields had a Field ID...
0
by: Mangler | last post by:
I have a form that does multiple updates on the page. For some reason that I cant figure out it is redirecting before the update is done. It doesnt do this on another page that I have. <% If...
11
by: cooperkuo | last post by:
Dear all, I have a question about ADO in the subform. I know how to use ADO to insert/update/select data into the sigin form, but wehn I try to do it in the form with subform((Datasheet). I don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.