SitePoint Sponsor

User Tag List

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

    need help with simple delete (currently in 2 queries)

    Hello,

    Excuse my lack of understanding subqueries... but I can't figure this one out on my own. Currently I have two queries I am running, and I'm positive I can accomplish this in one query. Any suggestions?

    First delete all emails that have a grp_id as "#".
    Code:
      $del_emails_sql = "DELETE FROM enews WHERE grp_id='$_POST[radioID] AND siteID='$_SESSION[siteID]'";
    Then delete the group id that = "#".
    Code:
      $del_grp_sql = "DELETE FROM enews_grps WHERE id='$_POST[radioID]' AND siteID='$_SESSION[siteID]'";
    Anyone? Thanks in advance.
    JP

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mysql.com
    MySQL does not support subqueries prior to Version 4.1, or the use of more than one table in the DELETE statement prior to Version 4.0.
    ^

  3. #3
    SitePoint Addict
    Join Date
    May 2002
    Location
    Louisville, KY
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so really there's no way to do this outside of subqueries?

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Just run two queries. Not that bad to have an extra line of code in your program.


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
  •