我正在使用临时表来获取使用自定义sql进行tableu可视化的结果:
SELECT *,
case when month(startdate) = month(enddate) then 'Y' else 'N' end as SameMonth,
into #temp
FROM t1
select a,b,c,d,e,f,g,h
from #temp where SameMonth = 'Y'
union
select a,b,c,d,e,k,l,m
from #temp where SameMonth = 'N'