1

What i have

customer_id
   1
   2 
   2
   1
   3

What i want (for all customer id's with 1 ,i want to flag as valid ,rest of the customer id's as invalid in the new column "warining_customer_id"

customer_id    warining_customer_id
   1             Valid
   2             Invalid
   2             Invalid
   1             Valid
   3             Invalid
2
  • 1
    Hint: CASE expression. Commented May 22, 2018 at 22:22
  • Use update table1 set warining_customer_id = ... Commented May 23, 2018 at 3:04

1 Answer 1

1

Here an example

SELECT   customer.customer_id AS customer_id,
         CASE WHEN customer.customer_id = 1 THEN 'Valid' ELSE 'Invalid' END
             AS warning_customer_id
  FROM   (SELECT   1 AS customer_id FROM DUAL
          UNION ALL
          SELECT   2 AS customer_id FROM DUAL) customer
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.