mercredi 30 mai 2018

Conditional substring

I have a table similar to:

--- ID ----  ErrorDescr ---
    1        Error: ERROR1 - ESK - motor problem
    1        Error: ERROR13 - EPN - window problem
    1        Human problem 

What i want:

--ID--ErrorType---Count
  1   ESK            1
  1   EPN            1
  1   Human problem  1

if the "ErrorDescr" starts with Error:... the i want substring after "-" and get the 3 char error code, but if there is no Error:... I just take the text....and count the instances of those text...

Anyone ?

Aucun commentaire:

Enregistrer un commentaire