473,378 Members | 1,409 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,378 software developers and data experts.

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.txtWhatIssue = tblIssues.ShortDesc,
tblResolve.txtCustomerDetails = tblIssues.CustomerDetails,
tblResolve.blnCustomerLost = tblIssues.CustomerLost,
tblResolve.txtActualCost = tblIssues.ActualCost, tblResolve.txtFUMLoss
= tblIssues.FUMLoss, tblResolve.txtActionTakenToResolve =
tblIssues.ActionTakenToResolve, tblResolve.txtSuggestedResolution =
tblIssues.SuggestedResolution
FROM tblResolve
INNER JOIN tblIssues ON tblResolve.intissuecode = tblIssues.IssueCode
WHERE tblResolve.intissuecode = forms!frmEnterIssues!IssueCode
;

When I run this query i get the following error:
Syntax error (missing operator) in the query expression
'tblIssues.SuggestedResolution
FROM tblResolve
INNER JOIN tblIssues ON tblResolve.intissuecode = tblIssues.IssueCode'

Can any one help me in getting this resolved.

Thanks in advance,
San.

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

UPDATE Table1 INNER JOIN Table2 ON Table1.lngPrimaryKey =
Table2.lngPrimaryKey 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.lngPrimaryKey, 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
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...
14
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...
17
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
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...
23
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...
15
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...
4
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...
2
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...
3
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.