Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    45
    Thanks
    16
    Thanked 0 Times in 0 Posts

    delete datas from 2 tables in single query

    table1

    rno m1 m2

    23 35 45


    table2

    rno s1 s2

    23 98 78

    iam using above tables .is it possible to delete rno=23 datas(rows) from both table1 and table2 in a single query.i tried DELETE FROM table1,table2 WHERE rno=23. but it not works.is their any way?

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,484
    Thanks
    23
    Thanked 636 Times in 635 Posts
    Try this:
    Code:
    DELETE FROM table1, table2 
    USING table1 
    INNER JOIN table2 USING(rno) 
    WHERE table1.rno = 23
    But PLEASE come back and tell me if it works.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •