sql語句Order by 報錯列名不明確


select top 10 column1,column2,column3 from table1 where table1.id not in(select top 0 table1.id from table1 order by column1 asc) order by column1 asc

注意這種寫法會報錯  列名 'column1' 不明確

在查下時不把列名寫出來,用* 就不會報錯,目前還不知道原因,有知道的請指點

select top 10 * from table1 where table1.id not in(select top 0 table1.id from table1 order by column1 asc) order by column1 asc

這樣就不會報錯了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM