How to make this request?

Hi all

I am using oracle 11g,

Here is my requirement.

Name of the table - emp_test with two columns

emp_id emp_text

1A - 000045 level of protection of personal information

B-09087 of level 2 of the privacy

3 level of confidentiality A 098765

4b level of confidentiality-00876

Expected result

emp_id emp_text emp_text1

1 null of A-000045 level of intimacy

2 null B-09087 level of privacy

3 level of confidentiality A 098765 null

4 null B level of confidentiality-00876

Concerning

Dale

Hi, Dale,

So, sometimes, the column emp_text in the output is identical to the emp_text column in the table and emp_text1 is null, and sometimes it's the other way around; is this fair?

How do you decide when the emp_text of output is identical to the original emp_test, and when it is NULL?

Depending on your needs, your data and your version of Oracle, here's one way:

SELECT emp_id

CASE

WHEN emp_text AS "Prvacy % level".

THEN emp_text

END AS emp_text

CASE

WHEN emp_text NOT AS "Prvacy % level".

THEN emp_text

END AS emp_text1

Of emp_test

;

If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.

Tags: Database

Similar Questions

Maybe you are looking for