Here, I have one Table T1.
In that table, I have one column F1 having some positive and negative values.
I want to display those values in two different columns.
select * from T1
F1
--------
1000
-2000
500
-1000
2000
-300
I want to display like this
Pos Neg
------- ------
1000 -2000
500 -1000
2000 -300
How to do this any suggestion?

Jignesh KumarPosted Apr 4, 2022, 8:05 AM
MAHAMDSALAM MULLAPosted Apr 4, 2022, 7:15 AM
Sachin SinghPosted Feb 12, 2022, 5:29 AM
Muhammad Imran AnsariPosted Feb 11, 2022, 7:06 PM
Mubarak HashmiPosted Feb 11, 2022, 4:27 PM
Create table sample
(
id int
)
insert into sample values(1000),(-1000),(500),(-2000),(2000),(-300)
select Neg.id as Negetive,Pos.id as Positive
from
(
select *,ROW_NUMBER()over( order by id) rownum from sample
where id<0)Neg
full outer join
(select *,ROW_NUMBER()over( order by id) rownum from sample
where id>=0)Pos
On neg.rownum=pos.rownum
Sujit SahooPosted Mar 11, 2019, 1:19 PM
Puneet KankarPosted Mar 11, 2019, 12:12 PM
Jignesh KumarPosted Mar 11, 2019, 11:21 AM