Once i created it, i cannot open it via SQL, Editor or Generate script as CREATE.
It just keep loading and eventually not responding.
Kindly advise.
SELECT *
FROM
(
SELECT *
FROM
(
SELECT Month, Store, Salesperson, SUM(Sales), COUNT(Transaction)
FROM Sales_associate
GROUP BY Month, Store, Salesperson
) sa
LEFT JOIN Target t on sa.Month=t.Month and sa.Salesperson=t.Salesperson
UNION ALL
SELECT *
FROM
(
SELECT Month, Store, Salesperson, SUM(Sales), COUNT(Transaction)
FROM Sales_supervisor
GROUP BY Month, Store, Salesperson
) ss
LEFT JOIN Target t on ss.Month=t.Month and ss.Salesperson=t.Salesperson
) a
JOIN dim_salesperson
JOIN dim_store
LEFT JOIN dim_kpi_setting kpi ON a.Month=kpi.Month and a.Sales between kpi.From_value and kpi.To_value