Hi I'm trying to apply a field filter to a second select (below), the filter is a date range selector, I need to get it's values to apply the filter again on select below, this select is manually data, I'm trying to get field filter value and replace, the column name, which originally is dbo.SD2010.D2_EMISSAO, but on my manual select is the date.
Anyone can help me with this?
SELECT
date, Tipo, Total
FROM (
VALUES
(DATEFROMPARTS(2022, 01, 01), 'Budget', 4470000),
(DATEFROMPARTS(2022, 02, 01), 'Budget', 4625000),
(DATEFROMPARTS(2022, 03, 01), 'Budget', 4695000),
(DATEFROMPARTS(2022, 04, 01), 'Budget', 5317000),
(DATEFROMPARTS(2022, 05, 01), 'Budget', 5643000),
(DATEFROMPARTS(2022, 06, 01), 'Budget', 5925000),
(DATEFROMPARTS(2022, 07, 01), 'Budget', 6109000),
(DATEFROMPARTS(2022, 08, 01), 'Budget', 6231000),
(DATEFROMPARTS(2022, 09, 01), 'Budget', 6362000),
(DATEFROMPARTS(2022, 10, 01), 'Budget', 6453000),
(DATEFROMPARTS(2022, 11, 01), 'Budget', 6585000),
(DATEFROMPARTS(2022, 12, 01), 'Budget', 6716000)
) AS TEMP(date, Tipo, Total)
[[
WHERE REPLACE(CAST({{date}} AS VARCHAR))), 'dbo.SD2010.D2_EMISSAO', 'date') -- Tried this but doesn't work.
]]