Return Multiple Rows On A Single Record
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
Solution 1:
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
Solution 2:
Try looking into SQL's pivot
Post a Comment for "Return Multiple Rows On A Single Record"