ORDER BY 子句在视 图、内联函数、派生表、子查询和公用表表达式中无效

SQL语句:

select * from

(
select distinct t2.issue,cashmoney from
(select distinct issue from lot_gamepara)t1 join
(select distinct cashmoney,issue from lot_cash)t2
on t1.issue = t2.issue order by issue,cashmoney
) tt1,
(select poscode from lot_game where type=1 and poscode =

'18757')tt2


问题:

消息 1033,级别 15,状态 1,第 7 行
除非另外还指定了 TOP 或 FOR XML,否则,ORDER BY 子句在视

图、内联函数、派生表、子查询和公用表表达式中无效。
消息 102,级别 15,状态 1,第 8 行

'tt2' 附近有语法错误。


解决方法:

把红色部分挪到tt2后面即可


你可能感兴趣的:(SQLServer,SQL)