One missing price is enough to make ALL return nothing while ANY returns rows. Here is how to see it, and how to ask the question more safely.
Large IN Lists: When a Temp Table Beats Thousands of Values
Pasting thousands of IDs into an IN list works, until it does not. See where the time goes and how to keep the answer the same with a temp table.
Destructive Reads: Pulling Work From a Queue Table With OUTPUT
Claiming a job and finishing it are two different things. Try a delete claim, a rollback, and an update claim on a tiny queue.
Common Table Expressions for Readability
Common table expressions for readability name query steps and support recursion, but they do not promise cached intermediate results.
SQL SERVER – How to Drop Temp Table – Check Existence of Temp Table
Readers often ask how to check existence of a temp table and how to drop temp table without Msg 2714. My earlier article answers all of these questions.
FIFO Inventory Costing in T-SQL: Matching Sales to Purchase Lots
Which purchase lot paid for which sale? Two running totals and one join answer it, with no cursor and no loop.
End-of-Day Balances From a Transaction Table
A transaction table stores movements, not balances. Collapse each day, run a total, fill the quiet days and dodge the midnight trap.







