473,569 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with Update query that has to fetch the values from another table

san
Hi,

I have the following update statement that updates one table by the
values from the other table which seems have some problem with the
syntax.

UPDATE tblResolve SET tblResolve.txtW hatIssue = tblIssues.Short Desc,
tblResolve.txtC ustomerDetails = tblIssues.Custo merDetails,
tblResolve.blnC ustomerLost = tblIssues.Custo merLost,
tblResolve.txtA ctualCost = tblIssues.Actua lCost, tblResolve.txtF UMLoss
= tblIssues.FUMLo ss, tblResolve.txtA ctionTakenToRes olve =
tblIssues.Actio nTakenToResolve , tblResolve.txtS uggestedResolut ion =
tblIssues.Sugge stedResolution
FROM tblResolve
INNER JOIN tblIssues ON tblResolve.inti ssuecode = tblIssues.Issue Code
WHERE tblResolve.inti ssuecode = forms!frmEnterI ssues!IssueCode
;

When I run this query i get the following error:
Syntax error (missing operator) in the query expression
'tblIssues.Sugg estedResolution
FROM tblResolve
INNER JOIN tblIssues ON tblResolve.inti ssuecode = tblIssues.Issue Code'

Can any one help me in getting this resolved.

Thanks in advance,
San.

Jan 17 '06 #1
1 1161
Your Inner Join needs to be moved up to follow the Update statement.
Something like:

UPDATE Table1 INNER JOIN Table2 ON Table1.lngPrima ryKey =
Table2.lngPrima ryKey SET Table1.strField = Table2.strField ,
Table1.lngField = Table2.lngField , Table1.blnField = Table2.blnField ,
Table1.dtmField = Table2.dtmField ;

Sounds like your storing a lot of the same or similar data in two
seperate tables, which is a big relational database no-no. You may just
want to maintain the Issues table till the issues are resolved then
post them to the Resolve table using an Append Query to avoid data
duplication in the interim. That SQL statement would be something like
this:

INSERT INTO Table1 ( lngPrimayKey, strField, lngField, blnField,
dtmField ) SELECT Table2.lngPrima ryKey, Table2.strField ,
Table2.lngField , Table2.blnField , Table2.dtmField FROM Table2;

Jan 18 '06 #2

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

Similar topics

1
4872
by: Ann | last post by:
Hello everyone, hope someone can help me with this. I have a SQL stored procedure that inserts a record into a table, creates a cursor to fetch the last record that was added to get the unique key that was created and then writes that and other info to a separate table. This procedure was working fine at our ISP under NT 4 and SQL 7. We...
14
47871
by: John | last post by:
Hi all, I am doing the change from having worked in Oracle for a long time to MS SQL server and am frustrated with a couple of simple SQL stmt's. Or at least they have always been easy. The SQL is pretty straightforward. I am updating a field with a Max effective dated row criteria. (PepopleSoft app) update PS_JOB as A set BAS_GROUP_ID...
17
1625
by: LineVoltageHalogen | last post by:
Table DDL: create table test ( inId int primary key identity, inFK int not null, inSeq int not null, dtDate datetime )
1
2038
by: teddysnips | last post by:
SQL Server 2000 I have a stored procedure that uses an extended SPROC to send an email notification to my customers when a document is distributed. However, the SPROC has an unexpected side effect. If I run it in its current incarnation, it only sends one email and then exits. However, if I remove or comment out the block
23
3462
by: Rudolf Bargholz | last post by:
Hi, I have a ralatively simple SQL: select FK from TABLE where upper(A) like 'B%' and upper(C) like 'D%' We have DB2 UDB v7.1 FP 12 installed on Linux and on Windows 2003 On Linux using optimization level 5 as well as 9 and 0 the SQL uses 3'100'000'000 timerons !
15
3606
by: Hemant Shah | last post by:
Folks, We have an SQL statement that was coded in an application many years ago (starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer does not use optimal path to access the data. It takes about 4 minutes to get the data. In previous versions it was instantaneous. What do I need to do to increase the performance?
4
1871
by: Mullin Yu | last post by:
i have a stored procedure at sql server 2k. which will update records and select result from temp table. if i use SqlConnection class, and i do both. but, if i use OleDbConnection class, i can have only records updated, but no result come out. how can i debug, and what's the error? thanks!
2
3139
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand...
3
3942
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID = ?
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.