extracting information from the "service"

Moderator: crythias

Post Reply
dfoliveira
Znuny newbie
Posts: 22
Joined: 13 Aug 2012, 14:28
Znuny Version: 6.0.29
Real Name: Douglas Oliveira
Company: Tractus Soluções e Serviços em TI
Location: São Paulo - SP - Brasil

extracting information from the "service"

Post by dfoliveira »

Hello,

I have a doubt about extracting information from the "service" table. I need to extract the service and subservice, as in the example below, but I don't know how to do it.
You do not have the required permissions to view the files attached to this post.
DOUGLAS OLIVEIRA
OTRS v6.29 - ITSM - SO Linux with MySQL
skullz
Znuny superhero
Posts: 635
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: extracting information from the "service"

Post by skullz »

Code: Select all

SELECT name AS 'Full Service Name', 

SUBSTRING_INDEX(name,'::',1) AS 'Main Service',

CASE WHEN LENGTH(name)-LENGTH(REPLACE(name, '::', '')) >= 2 THEN SUBSTRING_INDEX(SUBSTRING_INDEX(name,'::',2),'::',-1) ELSE NULL END AS 'Sub Service 1',

CASE WHEN LENGTH(name)-LENGTH(REPLACE(name, '::', '')) >= 4 THEN SUBSTRING_INDEX(SUBSTRING_INDEX(name,'::',3),'::',-1) ELSE NULL END AS 'Sub Service 2',

CASE WHEN LENGTH(name)-LENGTH(REPLACE(name, '::', '')) >= 6 THEN SUBSTRING_INDEX(SUBSTRING_INDEX(name,'::',4),'::',-1) ELSE NULL END AS 'Sub Service 3'

FROM service
good luck
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
dfoliveira
Znuny newbie
Posts: 22
Joined: 13 Aug 2012, 14:28
Znuny Version: 6.0.29
Real Name: Douglas Oliveira
Company: Tractus Soluções e Serviços em TI
Location: São Paulo - SP - Brasil

Re: extracting information from the "service"

Post by dfoliveira »

Thank you, perfect.

Thank you very much
DOUGLAS OLIVEIRA
OTRS v6.29 - ITSM - SO Linux with MySQL
Post Reply