Results 1 to 4 of 4

Thread: delete query ?

  1. #1
    Join Date
    Mar 2004

    Unanswered: delete query ?

    My problem is to delete data from a table test
    that has not related data in the table test2

    test :

    X a
    Y b
    Z b
    K a
    K a

    test2 :


    I want to delete from table test the two rows with key=K

    The SQLServer query for the above is

    DELETE FROM test FROM test LEFT JOIN test2 ON test2.sno=test.sno WHERE test2.sno IS NULL

    Please give the Oracle equivalent for the above SQL Server query, which should have the Theta LEFT JOIN conditions in Oracle statement for the SQL Server's 'LEFT JOIN' clause. I am specific to this point, since the above in Oracle can also be done with a subquery statement, but my requirement is that I need with a JOIN euqivalent of the SQL Server.

  2. #2
    Join Date
    Jun 2004
    Liverpool, NY USA
    You might want to research your homework for yourself. Being spoon fed doesn't do you any good.
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Mar 2004
    I think this is not going to be a spoon feeding for me, as I have tried a lot for this in 'DELETE' statement to get the same output as in SQL server. As I have said earlier, I need this particularly with JOIN conditions which lead to difficulty to find the same.

  4. #4
    Join Date
    Jul 2003
    You act as if you have read the documentation but still don't understand it.

    here are a few ways of doing this:

    PHP Code:
    delete from test where sno not in (select sno from test2);
    delete from test a 
    where not exists 
    (select null from test2 b where a.sno b.sno); 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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