Reputation: 11
I have one column table with negative and positive values and want to display positive and negative values in different columns using SQL Query.
Column
-10000
-17000
16000
25000
output should be like
A B
-----------------
-10000
16000
-17000
25000
Upvotes: 1
Views: 2748
Reputation: 453287
You can use a couple of CASE
expressions.
SELECT CASE
WHEN [Column] < 0 THEN [Column]
END AS A,
CASE
WHEN [Column] >= 0 THEN [Column]
END AS B
FROM YourTable
Upvotes: 5