Deleting a row in SQL

Discussion in 'Programming' started by aacircle, Nov 5, 2007.

  1. #1
    Hello,

    I was wondering if anyone is a master on SQL here?

    I'm looking to do the following in SQL. I'm sure my syntax is wrong, so would someone know if it is possible?

    Basically I want to delete rows in the zp_user table if those users are not in another table.

    Thank you.
     
    aacircle, Nov 5, 2007 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do it with a nested query as you have hinted at but with mytable.user being replaced with (select userid from mytable)

    Nested queries generally arent great for efficiency but it does sound like something that you wont be doing too often so wont be a big concern
     
    AstarothSolutions, Nov 5, 2007 IP
  3. aacircle

    aacircle Active Member

    Messages:
    142
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks. The below did it. Thanks for pointing me in the right direction. Cheers.

     
    aacircle, Nov 5, 2007 IP