Thursday, December 20, 2012

delete data from two tables at the same time in mysql


delete record from two table in same time in mysql 

it is useful when we create two related table in mysql   

 // with inner join 

DELETE tb1, tb2 FROM tb1 inner JOIN tb2  WHERE tb1.id=tb2.tb1id and tb1.id=1



 // with left or Right Join 

DELETE tb1, tb2 FROM tb1 LEFT JOIN tb2 ON tb1.id=tb2.tb1id  WHERE tb1.id=1

1 comment:

  1. superb.....blog is much interesting which engaged me more.Spend a worthful time.keep updating more.
    ecommerce website developers in hyderabad

    ReplyDelete

If you Satisfied , Please Leave a comment