SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Delete join?

  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Delete join?

    Okay before I SELECT tables using join.

    Now I want to delete it.
    Am I still going to use JOIN to delete the record the way I did with the SELECT JOIN.

    If yes, then can you show me sample on how to delete records using JOIN.
    By the way I'm using MyISAM because my hosting don't support InnoDB.

    But can you show me sample of delete with JOIN with MyISAM and InnoDB.

    Thanks in advanced.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,014
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    example --
    Code:
    DELETE users
         , comments
      FROM users
    INNER
      JOIN comments
        ON comments.userid = users.id
     WHERE users.postcount = 0
       AND users.joindate < CURRENT_DATE - INTERVAL 1 YEAR
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •