1

Possible Duplicate:
Update a table using JOIN in SQL Server?

I am stuck on a very simple query, an update with a join, I want to put the value of the field RECORDTYPE in the RECORDTYPE field = to the value of TEMPLATETABLE.RECORDTYPE

I tried with this but I get continuous syntax errors, which is the problem?

update MAINTABLE MT
set MT.MYTYPE =  TT.RECORDTYPE 
inner join TEMPLATETABLE TT on TT.ID_RECORD_TEMPLATE = MT.ID_RECORD_TEMPLATE
0

1 Answer 1

4

You are missing the FROM clause. Try this instead:

UPDATE MT
SET MT.MYTYPE =  TT.RECORDTYPE 
FROM MAINTABLE MT
INNER JOIN TEMPLATETABLE TT 
        ON TT.ID_RECORD_TEMPLATE = MT.ID_RECORD_TEMPLATE
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.