Results 1 to 5 of 5

Thread: delete record (MySql)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    Question delete record (MySql)

    How can I delete record that it's ID=8 ????

  2. #2
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236
    DELETE * FROM tableName WHERE ID = 8;

  3. #3
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    you don't need to put the * in according to the docs, that is just for compatibilty with Access apparently

  4. #4
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236
    wow, I didn't know that. So

    DELETE FROM tbl WHERE ID = '$x'

    will work fine by itself. Is that so with multi-table deletes?

    DELETE tblOne.*, tblTwo.* WHERE tblOne.ID = tblTwo.one_ID

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    yep
    The idea is that only matching rows from the tables listed before the FROM or before the USING clause are deleted. The effect is that you can delete rows from many tables at the same time and also have additional tables that are used for searching.

    The .* after the table names is there just to be compatible with Access:

    DELETE t1,t2 FROM t1,t2,t3 WHERE t1.id=t2.id AND t2.id=t3.id

    or

    DELETE FROM t1,t2 USING t1,t2,t3 WHERE t1.id=t2.id AND t2.id=t3.id

Posting Permissions

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



Click Here to Expand Forum to Full Width