Sub Query Syntax

  • HI,

    We have imported records into an sql dbase. It has appended two tables. It has been done in error and I need to delete the records that have been imported and leave the .

     

    My subquery looks like this:

    delete from tblorderline where OrderID in ( select * from tblOrders where Offercode = 'NWZ')

     

    But it errors saying that the select statement can have only one expression if there is no EXISTS intro.

    Have tried different things with no result - can anyone assist?

    Thanks,

     

    Newbie (Paul)

  • delete from tblorderline where OrderID in ( select OrderID from tblOrders where Offercode = 'NWZ')

  • or

    delete ol

    from tblorderline ol

    inner join tblOrders o

    on o.OrderID = ol.OrderID

    and o.Offercode = 'NWZ'

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply