2

table 1 :

 idtb1 --pk published delete 

table 2 :

 idtb2 --pk idtb1 --fk published delete 

how to update 2 column published ,delete on 2 table together by command Update

4
  • You mean with one update statement? Commented Mar 22, 2016 at 14:57
  • AFAIK not possible Commented Mar 22, 2016 at 14:58
  • @AndyWiesendanger : yup!, ^^! Commented Mar 22, 2016 at 15:29
  • @avkkamsy Did you try my solution? Commented Mar 22, 2016 at 15:46

1 Answer 1

4

You can't update more than one table in a single statement

 BEGIN TRANSACTION update A set A.published = @published from table1 A inner join table2 B on B.idtb1 = A.idtb1 update B set B.published = @published from table2 B inner join table1 A on B.idtb1 = A.idtb1 COMMIT 

This question already has an answer here

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.