group by 与 order by 一起使用的时候

select 后面的列+order by 后面的列 
必须在group by 里面

也就是说 select 和 order by 后面的列是 group by 列的子集

而 select 和 order by 之间是没有什么瓜葛的。

 

select [TYPE],LAST_VERSION,REMARK FROM VersionInfo WHERE SOP=N'123' group by [TYPE],LAST_VERSION,REMARK order by LAST_VERSION;
posted @ 2017-02-02 16:23  水墨晨诗  阅读(630)  评论(0编辑  收藏  举报