SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    delete from table where id not in active table (was "simple query problem")

    Hi,
    I have 2 tables
    info and active, in info it has column id that active also has as a foreign key from info

    I want to DELETE from table info where info.id is not contained in table active.

    help?

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Back up your data first as you should when doing a mass delete.
    Code:
    delete from info where id not in (select id from active)


Bookmarks

Posting Permissions

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