Click here to Skip to main content
16,021,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Input Table
-----------

Id Value
1 500
2 -250

output should be

id positives negatives
1 500 NULL
2 NULL -250
Posted

1 solution

try this
SQL
select a.id, 
"posit" = case
  when a.value > 0 then 'pos'
  else null
end ,
"negat" = case
  when a.value < 0 then 'neg'
  else null
end 

from  table a ;
 
Share this answer
 
v3
Comments
Shweta N Mishra 6-Jan-15 3:38am    
+5
pradiprenushe 6-Jan-15 4:38am    
thanks
Maddy selva 6-Jan-15 23:53pm    
my +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900