Say I have 1 table in mysql (called get) like this:
ID S Num
00 1 506
00 2 620
01 1 562
01 2 564
02 1 548
02 2 484
03 1 488
03 2 895
I am trying to get it in this format:
ID S1 S2
00 506 620
01 562 564
02 548 484
03 488 895
So far I have this, but it gives me an error:
select id,d.S1,c.S2 from
(select S as S1 from get where S=1)d inner join
(select s as S2 from get where S=2)c using (id);
I am still not too sure about joins, but this seems to make sense.
EDIT: S can have only 1 value at times, in these times, this value will be S1