Nov 27 2022
I am facing the challenge to run the below query in 2014 MS Sql server.
With Hotels as (select *from dbo.['2018$']unionselect *from dbo.['2019$']unionselect *from dbo.['2020$'])
can you please detect the error and help me to get away from this issue.
I am grateful to you..
Nov 28 2022
@praveshrawat , and which error message do you get?
First, don't use the asteriks * for all columns in a UNION statement. In a UNION all sub-queries must return the same count of column and the columns must have the same data type.
Is that the complete statement? If not, then you get an error because the final SELECT statement is misssing.
;WITH Hotels AS (...)