473,396 Members | 2,036 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.

Error Message in Update Query.

11
I am getting the following error: "Operation must use an updatable query"
I am trying to update a table that has no keys. I need to update one field in one row based on three fields in another row. To make it easier i copied the rows i need to compare to another table called newtable. Then i created the following query.
Expand|Select|Wrap|Line Numbers
  1. update table1 set field1 = ( select  newtable.acom from newtable, table1
  2. where ( newtable.somecode="TCP"+mid(newtable.somecode,4,15) and table1.field2=newtable.field2)
  3.  
  4. )
  5. where table1.field1= "TC"+mid(table1.field1,3,15);
But i keep getting the error message above. I have not been able to figure out a way to update table1. Any suggestions as to what i am doing wrong?
Thanks
Jul 2 '07 #1
3 1163
NeoPa
32,556 Expert Mod 16PB
Let's tidy up the code a little and see where that gets us first.
Expand|Select|Wrap|Line Numbers
  1. UPDATE [Table1]
  2. SET [Field1]=(SELECT [Acom]
  3.               FROM [NewTable] AS NT, Table1 AS T1
  4.               WHERE NT.SomeCode Like 'TCP*'
  5.                 AND NT.Field2=T1.Field2)
  6. WHERE [Field1] Like 'TC*';
This may not fix the whole problem but it's likely to be a much clearer position from which to work.
Also, your subquery uses a non-joined pair of tables. Is this what you intended?
Jul 2 '07 #2
ofilha
11
Let's tidy up the code a little and see where that gets us first.
Expand|Select|Wrap|Line Numbers
  1. UPDATE [Table1]
  2. SET [Field1]=(SELECT [Acom]
  3.               FROM [NewTable] AS NT, Table1 AS T1
  4.               WHERE NT.SomeCode Like 'TCP*'
  5.                 AND NT.Field2=T1.Field2)
  6. WHERE [Field1] Like 'TC*';
This may not fix the whole problem but it's likely to be a much clearer position from which to work.
Also, your subquery uses a non-joined pair of tables. Is this what you intended?
I will give it a try. Regarding your question, i am not sure. I actually need to perform the operation on one table. I merely put the records i wanted to get the data from in another table. But what i want is to update one column in one row from another column in another row based on the content of three rows which either match or partially match each other. I hope this makes sense. The table i am working on is not indexed and has no keys.
Jul 3 '07 #3
NeoPa
32,556 Expert Mod 16PB
You will need to provide a clearer explanation if you want help I'm afraid.
Table MetaData would be required to show us the sort of thing you're working with. Here is an example of how to post table MetaData :
Table Name=tblStudent
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; Autonumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
Jul 3 '07 #4

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

Similar topics

0
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type...
0
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
2
by: Earl Anderson | last post by:
We have a small (15MB) application which we run over our office network with 4 client stations. Anytime we use the "Find" function (from the main form which is based on a query of the main table)...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
3
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
7
by: Mark Carlyle via AccessMonster.com | last post by:
I have this update query that I am trying to run. I know the syntax is messed up but do not know how to correct it. Select 'UPDATE', Transactions,'Set = where = ' From "Get Daily Balances" ...
4
by: Robert Schuldenfrei | last post by:
Dear NG, I was about to "improve" concurrency checking with a Timestamp when I discovered that my current code is not working. After about a day of beating my head against the wall, I am...
7
by: Mathew Butler | last post by:
I'm investigating an issue I have when pulling data back from MS access I'm retrieving all rows from a column in a table of 5000 rows - accessing a column of type "memo" ( can be 65353 character...
15
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.