Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all
I am a new user to this fantastic tool, in my work we are use SQL server. My question is, why I can't see any data when I use Temp table in SQL queries. Note: (No error message)
Here is a simple query:
Select
t.Year
,Count(Distinct t.PersonId) Person
Into #Tmp
From
(
Select Distinct
x.PersonId
,MIN(datepart(yyyy, Date)) [Year]
From
X
Inner Join Y on X.x =Y.y
Group By
x.PersonId
) t
Group By
t.Year
Select
Year
,Person
,SUM (Person) OVER (Order By Year Rows Between UNBOUNDED PRECEDING AND CURRENT ROW) As CumulativeTotal
From
#Tmp
Drop Table #Tmp