Delete Statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ample
    New Member
    • Oct 2006
    • 6

    #1

    Delete Statement

    I need a delete statement to delete records using the below select statement. I got a mind block as to what should be used in the where clause column operator.

    Code:
    DELETE from InvOnHand
    WHERE [I]<unknown column operator>[/I]
    (SELECT InvOnHand.*
    FROM   InvMaster Join InvOnHand On InvMaster.partno = InvOnHand.partno
    WHERE  InvMaster.category = 'bag' and DatePart(yyyy, transdate) between 2004 and 2007 and NOT (InvOnHand.partno in (partlist))
    Code:
    SELECT InvOnHand.*
    FROM   InvMaster Join InvOnHand On InvMaster.partno = InvOnHand.partno
    WHERE  InvMaster.category = 'bag' and DatePart(yyyy, transdate) between 2004 and 2007 and NOT (InvOnHand.partno in (partlist))
  • Ample
    New Member
    • Oct 2006
    • 6

    #2
    What through me off was the first optional keyword "from". Got r done.


    Code:
    DELETE InvOnhand
    FROM InvMaster Join InvOnHand On InvMaster.partno = InvOnHand.partno
    WHERE  InvMaster.category = 'bag' and DatePart(yyyy, transdate) between 2004 and 2007
          and NOT (InvOnHand.partno in (partlist)

    Comment

    Working...