Vipin
Vipin

Reputation: 261

Update Query with INNER JOIN between tables?

I am trying to Update a column in a table in one database after doing inner join. While using the given below query is showing an error. The error is : "Unable to parse query text." Help me to find a proper solution. Thank you.

SQL:

UPDATE  tbl_plan SET Mail_Status = 'Sent' INNER JOIN
tbl_Assignment ON tbl_Assignment.Plan_ID = tbl_plan.Plan_ID
WHERE (DATEDIFF(dd, { fn NOW() }, Date) = 2) AND (Mail_Status IS NULL)

Upvotes: 0

Views: 792

Answers (1)

Coding Flow
Coding Flow

Reputation: 21881

You have got the format of an update query with a join in it slightly wrong. Try this instead

UPDATE p  
SET Mail_Status = 'Sent' 
FROM tbl_plan p
INNER JOIN tbl_Assignment a ON a.Plan_ID = p.Plan_ID
WHERE (DATEDIFF(dd, { fn NOW() }, Date) = 2) AND (Mail_Status IS NULL)

Upvotes: 3

Related Questions