display message [message #433086] |
Sun, 29 November 2009 23:32  |
prakashaa
Messages: 31 Registered: November 2009 Location: Bangalore
|
Member |
|
|
Hi experts goodmoring to all,
Please help me on this scenario
If the department no.is 10 ,then the message should be like this
"Department is 10"
If the salary is less than 1000 ,then the message should be like this
"salary is lessthan 1000"
If one row satifies both the conditions the message should be like this "Department is 10
salary is lessthan 1000"
The output should be like this
Deptno Sal Message
10 800 Department is 10
salary is lessthan 1000
10 900 Department is 10
salary is lessthan 1000
10 1200 Department is 10
10 1500 Department is 10
For that i tried the following code
SELECT deptno,sal,
case when deptno=10 then 'Department is 10'
when sal<1000 then 'salary is lessthan 1000'
END "message"
FROM emp;
but in this iam getting only one message
even if the both the conditions are satisfied please help me.
Thanks in advance
|
|
|
|
|
|