|
|
|
|
|
by RaftPeople
153 days ago
|
|
> completely missing some elegant and profound beauty. Requires some dynamic SQL to construct, but the beauty is that you can use the SQL engine for this solution: select top 1 * from (select t1.id,t2.id,...,tn.id ,sum(t1.cost+t2.cost...+tn.cost) as total_cost from join_options t1 cross join join_options t2 ... cross join join_options tn group by t1.id,t2.id,...,tn.id) t0 order by t0.total_cost |
|