This problem has got me stumped for a while now...
I have several tables, and I want:
TableX.one as a1, TableX.two as a2 WHEN TableX.three = '1'
TableX.one as b1, TableX.two as b2 WHEN TableX.three = '2'
There are other values for TableX.three, but I only want the rows where it's 1 or 2.
The data in TableX looks something like:
id____one_____two_____three
100___10______15______1
100___20______25______2
Basically, I want to get the following data at the end
a1, a2, b1, b2 for each id
All in 1 row. Is this possible?
ex:
Currently, my output looks something like this:
id______a1____a2_____b1_____b2
100____10____ 15____null ____null
100___ null____null____20_____25
where I have 2 rows.
and I want to end up looking like this:
id_____a1____a2_____b1_____b2
100____10____15____20______25
where it makes it all into 1 row.
I have several tables, and I want:
TableX.one as a1, TableX.two as a2 WHEN TableX.three = '1'
TableX.one as b1, TableX.two as b2 WHEN TableX.three = '2'
There are other values for TableX.three, but I only want the rows where it's 1 or 2.
The data in TableX looks something like:
id____one_____two_____three
100___10______15______1
100___20______25______2
Basically, I want to get the following data at the end
a1, a2, b1, b2 for each id
All in 1 row. Is this possible?
ex:
Currently, my output looks something like this:
id______a1____a2_____b1_____b2
100____10____ 15____null ____null
100___ null____null____20_____25
where I have 2 rows.
and I want to end up looking like this:
id_____a1____a2_____b1_____b2
100____10____15____20______25
where it makes it all into 1 row.