There are a lot of order parameters, is it possible to join them in the "one" pass?
select * from [order] cross join ( select max(case when id_par=1 then value end) p1, max(case when id_par=2 then value end) p2 -- .... from orderparams where orderparams.id_order = [order].id ) t There is an error in the last line, because it is impossible to "inside" the request to send [order] .id, it is not available there. Is it possible to somehow link these tables in this way without using a function or grouping? (mssql-server 2005) Parameters of the order of 10-20 pieces.
gorup by id_orderin the subquery, add this field to the select list and execute the usualON t.id_order=[order].id. Or look in the direction of cross apply, he did not work with him, but something suggests that this is what you need - Mikecross joincross applysuitable. - i-one