Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Adding Values From CTE Columns into A Global Temp Table

$
0
0
Please point out why I am getting errors saying that my CTE columns are invalid. The following is my query.[code="sql"]with QuarterEarning as(select Top(2) Product, [Quarter One Earnings], Rank() over (order by [Quarter One Earnings] asc) as Earnings from dbo.Sales)select Product, [Quarter One Earnings] into ##Qtable from QuarterEarningselect ##Qtable.Product, ##Qtable.[Quarter One Earnings] from ##Qtable order by ##Qtable.[Quarter One Earnings] asc;[/code]

Viewing all articles
Browse latest Browse all 3145

Trending Articles