Select all tickets with description field for a queue

Moderator: crythias

Post Reply
konak0508
Znuny newbie
Posts: 11
Joined: 16 Mar 2020, 16:51
Znuny Version: OTRS 2.2.5
Real Name: Karthik Kona
Company: CNSI

Select all tickets with description field for a queue

Post by konak0508 »

Hi OTRS Team,

I would like in your help with writing an SQL qeury which can get all tickets for a particular Queue with its description field. Can you please help me on this? i m not an pl/sql developer and i have no idea to qeite a query. And is there a way to get all the table names in SQL box? I tried SHOW TABLES but it says otrs.TABLES doesn't exist

Thanks
Karthik
wurzel
Znuny guru
Posts: 3230
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Select all tickets with description field for a queue

Post by wurzel »

hi,

why not using the statistics?

Flo
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
skullz
Znuny superhero
Posts: 621
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Select all tickets with description field for a queue

Post by skullz »

Well if my english is correct, he want to print out ticket with description (i guess 1st article body). Unless default statistic already support 1st article, i think only possible via sql / api.

Hint:
In database, look at table ticket and article
konak0508
Znuny newbie
Posts: 11
Joined: 16 Mar 2020, 16:51
Znuny Version: OTRS 2.2.5
Real Name: Karthik Kona
Company: CNSI

Re: Select all tickets with description field for a queue

Post by konak0508 »

Hi Wurzel,
I tried the search option and got the csv but the description field was missing.

Hi skullz,

Yes that is correct. I m trying to pull all the tickets for a particular queue with tickets' description too. Thanks for the input. will check on that. I couldn't actually pull the correct table names.

Thank you
Karthik
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Select all tickets with description field for a queue

Post by crythias »

The schema:
https://ftp.otrs.org/pub/otrs/doc/datab ... tabase.png

Assuming "Description field" is "Title":

Code: Select all

SELECT t.tn AS TicketNumber, t.title AS Description FROM ticket t left join queue q on q.id=t.queue_id where q.name="Raw" LIMIT 40
If "Description" is a Dynamic Field (or, say, the body of the first article) it gets a little tougher.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply