"Invalid column name" ORDER BY

user3587597

When i run my query i receive the following message:

Invalid column name 'column1'

query:

SELECT TOP 1 * From (
(select Top 2 convert(datetime,column1,101) AS TEST from table1 ORDER BY column1 DESC) X                   
ORDER BY column1)
Juan Carlos Oropeza
SELECT TOP 1 TEST 
From (
       SELECT Top 2 
            convert(datetime,column1,101) AS TEST,
            column1         // <- include column1
       FROM  table1 
       ORDER BY column1 DESC
     ) X                   
ORDER BY column1 ASC

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related