tags:

views:

36

answers:

2

Hi All,

I need to retrieve this result:

ROW1.id | ROW2.id | ROW3.id | ROW4.id
   1    |    2    |    3    |    4

starting from this result select * from Table:

id | value
1  | sample1
2  | sample2
3  | sample3
4  | sample4

any idea?

thanks, Andrea

+1  A: 

Try looking into SQL's pivot

froadie
the OP needs it for mysql
devnull
+1  A: 

you can do something like that:

select 
 (select id from table X where X.something = 123) as row1Id,
 (select id from table X where X.something = 456) as row2Id,
 (select id from table X where X.something = 789) as row3Id
BitKFu
Great! It's exactly what I was looking for! Thanks!
Andrea Girardi