0

I expose my problem : This is my table :

id      ticket_id   Severity    Changed_field    Last_modified_date
1       ticket1     Minor                        01/01/2013
2       ticket1                 Category         02/01/2013
3       ticket1                 Status           03/01/2013
4       ticket1     Major       Severity         04/01/2013
5       ticket1                 Assigned_to      05/01/2013

I look to have :

id      ticket_id   Severity    Changed_field    Last_modified_date
1       ticket1     Minor                        01/01/2013
2       ticket1     Minor       Category         02/01/2013
3       ticket1     Minor       Status           03/01/2013
4       ticket1     Major       Severity         04/01/2013
5       ticket1     Major       Assigned_to      05/01/2013

or :

id      ticket_id   Severity    Changed_field    Last_modified_date
1       ticket1     Major                        01/01/2013
2       ticket1     Major       Category         02/01/2013
3       ticket1     Major       Status           03/01/2013
4       ticket1     Major       Severity         04/01/2013
5       ticket1     Major       Assigned_to      05/01/2013
1
  • What result do you really want? How it would be formed? I can suppose the first use the last Severity which is not null, but I can't be sure, as you didn't even tried to explain what you wanted. About the second, I have no idea... Commented Oct 7, 2013 at 13:29

1 Answer 1

1

How about

SELECT 
     id
    ,ticket_id
    ,CASE WHEN COALESCE(Severity, '') = ''
             THEN 'Minor'
             ELSE Severity
     END AS Severity
    ,Changed_field
    ,Last_modified_date
FROM YOUR_Table
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.