日期:2014-05-18  浏览次数:20742 次

为什么有个列无效?
SQL code

SELECT TOP 7 * FROM TBL_Info WHERE IndexTop = 1 AND NOT EXISTS
    (SELECT TOP 1 * FROM TBL_Info WHERE IndexTop = 1 ORDER BY PublishTime DESC)
     ORDER BY PublicTime DESC


提示PublishTime列无效。不太懂EXISTS用法,怎么改才对呢?谢谢~!

------解决方案--------------------
TBL_Info表里有PublishTime这个列吗?
------解决方案--------------------
那个列名是否不存在?

SQL code
SELECT TOP 7 * FROM TBL_Info WHERE IndexTop = 1 AND CHECKSUM(*) NOT IN
    (SELECT TOP 1 CHECKSUM(*) FROM TBL_Info WHERE IndexTop = 1 ORDER BY PublicTime DESC)
     ORDER BY PublicTime DESC