Answers.Body: <p>General advice is don't use SQL directly - use the API.  You don't have to write code if you use <a href="https://github.com/civicrm/cv" rel="nofollow noreferrer">cv</a> or API explorer.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-24T05:14:18.553Z
Answers.Text: woo hoo  that API explorer is a thing of beauty.. wish I'd looked at that before.. thanks for the suggestion.. and a huge thanks to the people who built it
Answers.UserDisplayName: Robinnz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-23T08:55:31.533Z
Answers.LastActivityDate: 2018-02-23T08:55:31.533Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>If you know your ID then you would most likely use IN (1,5,7,etc)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-23T04:36:40.997Z
Answers.Text: thanks Pete.. is it Ok to delete that way if the event has participants?
Answers.UserDisplayName: Robinnz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-24T00:12:27.880Z
Answers.Text: first delete the Participants via the UI or sql but be warned deleting via sql does not necessarily cascade down to remove all other related data eg Contributions or Activities related to the Participant registration
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-25T19:35:24.637Z
Answers.Text: see Aidan's API answer for a better solution
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-23T02:12:23.183Z
Answers.LastActivityDate: 2018-02-23T02:12:23.183Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>We've had a bit of a mix up and imported the same set of events twice.  Most if not all of the duplicates have no participants (but I'm not 100% certain of that)</p>
  
  <p>Is there a way to bulk delete these duplicates?  I can't code but I can use sql a bit</p>
  
  <p>I've seen this suggested: "DELETE from civicrm_event WHERE id=1".  is that ok to use on multiple events?  Is it ok to use if an event has participants?</p>
  
  <p>thanks</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-23T08:49:21.243Z
Comments.Text: Do you mean you have imported the events twice (title, description, date, location etc), or that you have imported a list of participants twice?  How did you do the import?
Comments.UserDisplayName: Aidan
Tags: <civievent><api><sql><delete>
Title: Bulk delete of events - is such a thing possible?
ThreadText: # Bulk delete of events - is such a thing possible?
  
  (Asked by: username_0 on 2018-02-23)
  
  We've had a bit of a mix up and imported the same set of events twice. Most if not all of the duplicates have no participants (but I'm not 100% certain of that)
  
  Is there a way to bulk delete these duplicates? I can't code but I can use sql a bit
  
  I've seen this suggested: "DELETE from civicrm\_event WHERE id=1". is that ok to use on multiple events? Is it ok to use if an event has participants?
  
  thanks
  
  **Tags:** civievent, api, sql, delete
  
  > **Comments:**
  > **username_1**: Do you mean you have imported the events twice (title, description, date, location etc), or that you have imported a list of participants twice?  How did you do the import?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-02-23. Score: 2 | Accepted answer
  
  General advice is don't use SQL directly - use the API. You don't have to write code if you use [cv](https://github.com/civicrm/cv) or API explorer.
  
  > **Comments:**
  > **username_0**: woo hoo  that API explorer is a thing of beauty.. wish I'd looked at that before.. thanks for the suggestion.. and a huge thanks to the people who built it  
  
  ---
  
  ### Answer by username_2 on 2018-02-23. Score: 0
  
  If you know your ID then you would most likely use IN (1,5,7,etc)
  
  > **Comments:**
  > **username_0**: thanks Pete.. is it Ok to delete that way if the event has participants?  
  > **username_2**: first delete the Participants via the UI or sql but be warned deleting via sql does not necessarily cascade down to remove all other related data eg Contributions or Activities related to the Participant registration  
  > **username_2**: see username_1's API answer for a better solution  
  
  ---
  
  