SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast WizyWyg's Avatar
    Join Date
    Sep 2001
    0 Post(s)
    0 Thread(s)

    Need help with a DELETE syntax

    I am trying to delete records from two different tables at one time.In event table I have eventid and eventname
    in participants table I have eventid and nameparticipants table associates who will be attending events in table 1. So eventid = eventid for how many people are attending.What would be the delete syntax for Mysql, if I want to delete from table event eventid=1 and all those associated in the participants table where eventid=1I know that these work:
    DELETE FROM participants WHERE eventid=1
    DELETE FROM event WHERE eventid=1How can i combine the two? running with MySQL 3.23.47

  2. #2
    SitePoint Addict BenANFA's Avatar
    Join Date
    Apr 2003
    Bath, UK
    0 Post(s)
    0 Thread(s)
    You can't combine DELETEs to 2 differing tables. Why do you want to ? If it is to make sure that there are no acceses to the tables while they are not synchronised then use the

    LOCK TABLES and UNLOCK TABLES commands to ensure that you have exclusive access to the tables for the entire operation.


Posting Permissions

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