Если вы хотите четыре столбца, вы можете использовать row_number()
или pivot
:
select max(case when seqnum = 1 then okeydata end) as col_1,
max(case when seqnum = 2 then okeydata end) as col_2,
max(case when seqnum = 3 then okeydata end) as col_3,
max(case when seqnum = 4 then okeydata end) as col_4
from (select okeydata,
row_number() over (order by (select null)) as seqnum
from [elo].[dbo].[objkeys]
where parentid in (select parentid
from [elo].[dbo].[objekte] inner join
[elo].[dbo].[objkeys]
on objid = parentid
where objmask like 26 and okeydata like 1
)
) o;