Reputation: 53
update v, s
set v.closed = 'Y'
where v.closed <> 'y'
and v.canceldate < '12.01.2017'
and s.salesrep1 = 'bd'
and v.orderno = s.orderno
This is my query and I get this error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.
Upvotes: 0
Views: 75
Reputation: 34231
The problem is most likely that you mixed up what rdbms product you use. The error message is from MS SQL Server, while the question is (well, was) tagged as mysql.
The syntax used in the question is allowed in mysql, but is not allowed in MS Sql Server, hence the error message.
In MS Sql Server try the following syntax:
update v set v.closed = 'Y'
from v inner join s
on v.orderno = s.orderno
where v.closed <> 'y'
and v.canceldate < '12.01.2017'
and s.salesrep1 = 'bd'
See ms sql server reference on update statement for details
Upvotes: 1
Reputation: 11
I would pur it like this (on sql server)
update v
set v.closed = 'Y'
From v inner join s
On v.orderno = s.orderno
Where v.closed <> 'y'
and v.canceldate < '12.01.2017'
and s.salesrep1 = 'bd'
Upvotes: 1