SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2002
    Location
    Louisville, KY
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to delete multiple rows with WHERE?

    Hello,

    I am trying to figure out how to delete multiple rows using the WHERE clause. I know I can use IN (12, 32, 34) but I don't know the ID's... so I assumed I could do something like this:

    Code:
     
    DELETE FROM t1 WHERE (siteID='1004' AND emails='abc@abc.com' AND grpID='1'), (siteID='1004' AND emails='def@def.com' AND grpID='1')
    But this ain't even comin close. Any one have any ideas?

  2. #2
    SitePoint Addict
    Join Date
    May 2002
    Location
    Louisville, KY
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah ha! Figured it out. This worked fine:

    Code:
    DELETE FROM enews WHERE siteID='1004' AND  grp_ID='1' AND emails IN ('abc@abc.com', 'def@def.com')
    Exactly what I needed. Maybe this will help someone else?

  3. #3
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Zürich, Switzerland
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jpfour23
    Exactly what I needed. Maybe this will help someone else?
    Jup, that helps me a lot

    thx very much


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
  •