In the code below, the resulting error is "object t does not exist". T is the derived table defined in FROM. Rather than refiltering in the SELECT subquery, I would like to use the derived table to save on processing. Since FROM is processed first in the order of operations, I feel that there should be a way for me to refer to "t" in the SELECT.
(I am in Teradata in case that matters)
SELECT (100000/(SELECT COUNT(DISTINCT EXTRACT(DAY FROM t.saledate))
FROM t
WHERE EXTRACT(MONTH FROM t.saledate) = 11)) as "NOVEMBER"
FROM (SELECT sprice, quantity, sku, store, saledate
FROM trnsact
WHERE (saledate BETWEEN '2004-11-01' AND '2004-12-31')
) as t