(记录) sql exists 应用及 order by注意点

if exists (select top 1 * from adminlog where memberPermit='heyq' order by record_id desc)
 
print 'xx'
else
 
print 'yy'

 if exists( select  * from adminlog where memberPermit='heyq' order by record_id desc)
error: 除非同时指定了 TOP,否则 ORDER BY 子句在视图、内嵌函数、派生表和子查询中无效。

原文地址:https://www.cnblogs.com/yuanchong/p/1467461.html