Matching Supply With Demand — Solutions, Part 1
SQL Performance
JANUARY 12, 2022
The outer query also computes the trade quantity in the SELECT list as: LEAST ( EndDemand , EndSupply ) - GREATEST ( StartDemand , StartSupply ) If you're using Azure SQL, you can use this expression. It's curious the optimizer chose one strategy for the demand intervals and another for the supply intervals.
Let's personalize your content