Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error In UPDATE statement?

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
Hi Guys,

This is kind of a general question, but I am puzzled as to why this is happening. I have this query (Please don't assault me over the table names. I did not design this thing, and I don't have time to change hundreds of queries to reflect the field and table names I would've used).

Code:
UPDATE InputData AS U INNER JOIN [select b.ID, b.[Plan Code], a.CODE as 2007Code
FROM
(
select y.*, z.PRODUCT 
from InputData y
INNER JOIN [tbl PlanCodes] z
on y.[Plan Code] = z.code
and y.[STATE] = z.[STATEABBR]
) 
b 
INNER JOIN
(
select * from [tbl PlanCodes] where YEAR = 2007
)
a 
on b.PRODUCT = a.PRODUCT
and
b.STATE = a.STATEABBR
]. AS T ON U.ID = T.ID SET U.[Plan Code] = T.[2007Code]
WHERE SourceFileName like 'IVR*';

Which works fine. However, when I typed it, the main subquery (T) was in parentheses (not brackets) and did not have the period before AS T.

This query, as it exists now, I cannot alter. I needed to remove the where clause, and when I did, I got a message saying 'Syntax Error In Update Statement'.

I was able to update the query by typing it as I did before (with the parentheses and no period), but I don't really understand

a. Why the changes when it saves?
and b. Why in the saved format can I not change it?

Am I getting close to making it too complex for the jet engine?

Any and all insights much appreciated.

Thanks,

Alex



Ignorance of certain subjects is a great part of wisdom
 
Sorry guys, I promise this will be the only time. But <bump!>

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top