1

My Query :

UPDATE i SET i.CurStock = i.CurStock-g.Qty  
    FROM inv_inventarymaster AS i INNER JOIN inv_goodsissue AS g  
    ON  i.ItemName = g.ItemName WHERE g.DATE='2014-03-20';

Error:

You have an error in your SQL syntax; check the manual that correspond to your MySQL server version for the right syntax to use near 'FROM inv_inventarymaster as i INNER JOIN inv_goodsissue as g ON ' at line 1

Kindly help me getting the right syntax.

1

2 Answers 2

1

Try this ...Not Tested but as MYsql http://dev.mysql.com/doc/refman/5.0/en/update.html

UPDATE inv_inventarymaster AS i INNER JOIN inv_goodsissue AS g SET 
i.CurStock = i.CurStock-g.Qty 
WHERE i.ItemName = g.ItemName and g.DATE='2014-03-20';
Sign up to request clarification or add additional context in comments.

1 Comment

@user3092228 : dont forget to mark accepted if it helped...i am upvoting on your behalf!! ;)
0

its not a right thing to use FROM in Mysql UPDATE query.

You can use the query like this

UPDATE inv_inventarymaster AS i 
INNER JOIN inv_goodsissue AS g  ON i.ItemName = g.ItemName 
SET i.CurStock = i.CurStock-g.Qty  
WHERE g.DATE='2014-03-20';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.