Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Delete Department and all its tickets

If I delete a department all tickets associated to this department remains in osticket. I want to remove everything associated to a specific department. How can I do that? I guess the easiest solution is to run some mysql query, isnt it? What queries are necessary?


  • Personally I would use the advanced search and select the department in the drop down.  Then click select all, click delete.  If you have a ton of tickets in that department that you might need to do a few pages.  This is the cleanest way to do this.

    If you're hell bent on doing it via MySQL then the first thing that you would want to do is take a look at your department table and get the dept_id of the department that you want to delete all the tickets. Once you have it, you can match the tickets in your ticket table.  You can then do something like

    DELETE FROM ost_ticket WHERE dept_id = #

    Note: this will NOT remove tickets data such as attachments, messages, notes, form data, etc.  You should really figure out how to clean up that data to if you want to do it via the database.  I would not do it this way.
  • Thanks for your help.

    A search result in
    [quote]Search criteria matched 70095 tickets[/quote]

    I will take a look into the php script hopefully I can find out which mysql queries to run.

Sign In or Register to comment.