{"id":55888,"date":"2013-07-18T09:35:15","date_gmt":"2013-07-18T16:35:15","guid":{"rendered":"http:\/\/tri.be\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/"},"modified":"2015-07-07T06:27:01","modified_gmt":"2015-07-07T13:27:01","slug":"this-is-the-mysql-code-to-delete-tickets","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/","title":{"rendered":"This is the MySQL code to delete tickets"},"content":{"rendered":"<p>Hi All,<\/p>\n<p>I realised that a lot of people are asking how to delete the tickets.<br \/>\nJust find and replace all instances of 886 with ur ticket id.<\/p>\n<p>For the developers, I already provided the code? haha. If you could do us all a favour and implement it into a simple &#8220;delete&#8221; link on each ticket in the attendees list or provide it as a function for the checkboxes, it would be uber duper awesome&#8230;<\/p>\n<p>Hope it helps everyone.<\/p>\n<p>So if you are a developer or a mini DBA, here is the MySQL code (For the the ugly):<\/p>\n<p># Finds the product associated with the ticket<br \/>\n# Updates the total sales by reducing by 1<br \/>\nUPDATE events_postmeta<br \/>\nINNER JOIN (<\/p>\n<p>\tSELECT meta_value FROM events_postmeta<br \/>\nWHERE post_id = &#8216;886&#8217;<br \/>\nAND meta_key = &#8216;_tribe_wooticket_product&#8217;<\/p>\n<p>)<br \/>\nAS ticket_number<br \/>\nON ticket_number.meta_value = events_postmeta.post_id<br \/>\nSET events_postmeta.meta_value = events_postmeta.meta_value -1<br \/>\nWHERE events_postmeta.meta_key = &#8216;total_sales&#8217;;<\/p>\n<p># Finds the product associated with the ticket<br \/>\n# Updates the _stock by increasing it by 1<br \/>\nUPDATE events_postmeta<br \/>\nINNER JOIN (<\/p>\n<p>\tSELECT meta_value FROM events_postmeta<br \/>\nWHERE post_id = &#8216;886&#8217;<br \/>\nAND meta_key = &#8216;_tribe_wooticket_product&#8217;<\/p>\n<p>)<br \/>\nAS ticket_number<br \/>\nON ticket_number.meta_value = events_postmeta.post_id<br \/>\nSET events_postmeta.meta_value = events_postmeta.meta_value + 1<br \/>\nWHERE events_postmeta.meta_key = &#8216;_stock&#8217;;<\/p>\n<p># Delete the ticket details<br \/>\nDELETE events_postmeta FROM events_postmeta<br \/>\nWHERE post_id = &#8216;886&#8217;;<\/p>\n<p># Delete the ticket<br \/>\nDELETE events_posts FROM events_posts<br \/>\nWHERE ID = &#8216;886&#8217;;<\/p>\n","protected":false},"template":"","class_list":["post-55888","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>This is the MySQL code to delete tickets -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"This is the MySQL code to delete tickets -\" \/>\n<meta property=\"og:description\" content=\"Hi All, I realised that a lot of people are asking how to delete the tickets. Just find and replace all instances of 886 with ur ticket id. For the developers, I already provided the code? haha. If you could do us all a favour and implement it into a simple &#8220;delete&#8221; link on each [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-07-07T13:27:01+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/\",\"name\":\"This is the MySQL code to delete tickets -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2013-07-18T16:35:15+00:00\",\"dateModified\":\"2015-07-07T13:27:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Tickets Plus\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"This is the MySQL code to delete tickets\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"This is the MySQL code to delete tickets -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/","og_locale":"en_US","og_type":"article","og_title":"This is the MySQL code to delete tickets -","og_description":"Hi All, I realised that a lot of people are asking how to delete the tickets. Just find and replace all instances of 886 with ur ticket id. For the developers, I already provided the code? haha. If you could do us all a favour and implement it into a simple &#8220;delete&#8221; link on each [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/","article_modified_time":"2015-07-07T13:27:01+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/","name":"This is the MySQL code to delete tickets -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2013-07-18T16:35:15+00:00","dateModified":"2015-07-07T13:27:01+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/this-is-the-mysql-code-to-delete-tickets\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Event Tickets Plus","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/"},{"@type":"ListItem","position":5,"name":"This is the MySQL code to delete tickets"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/55888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/55888\/revisions"}],"predecessor-version":[{"id":979508,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/55888\/revisions\/979508"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=55888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}