Skip to content
Theory · Set operations and CTEs · lesson 5 of 10

WITH: a query in steps

Picture a big spreadsheet. To work out something complex, you add a helper sheet: you compute intermediate totals on it and give the sheet a clear name. The main formula then refers to that sheet instead of repeating the whole calculation. You can read it in a second: "take the totals from the Orders by employee sheet".

In this lesson

  • WITH names a step
  • A query can have several steps
  • Common mistake
  • Key points