私はテーブルCustomer_AJ(顧客varchar、アイテム番号、購入日時)を持っていますが、私はそれを持つ2つのテーブルがあり、失敗と失敗し、その顧客のために次の30分で。Azure SQLデータベース左結合150万レコードのループ
with Failure as (
select * from [dbo].[Customer_AJ] where item in (20, 34, 35, 36, 37, 47, 53, 54)
) ,
success as (
select * from Customer_AJ where Item in (1, 3, 40, 42, 43, 5)
) ,
final as (
select f.customer, f.item,f.purchase from Failure f left outer join success s
on f.customer = s.customer and DATEDIFF(minute , f.purchase , s.purchase) between 0 and 30
where s.customer is NULL
)
select * from final
Here is the Query Execution plan for it
ライブクエリ統計のスクリーンショットではなく、実際の実行計画XMLを過ぎてhttps://www.brentozar.com/pastetheplan/に移動し、質問へのリンクを追加します。 –