https://stackoverflow.com/questions/30045871/sorting-the-view-based-on-frequency-in-sql-server

Just like in sub queries, you can't use ORDER BY in a view definition in sql server unless you also use TOP.

The reason for this is that Views are acted upon as if they where tables, and tables in sql server (in fact, in any relational database) are considered as not ordered sets.
Just like there is no meaning to the order of records stored in a table,
there is also no meaning to the order of records fetched by a view.
You can use a dirty hack and write SELECT TOP 100 PERCENT ... and then use ORDER BY, but I doubt if it has any meaning at all.

Having said all that, you can of course use ORDER BY in any query that selects from a view.

 
select top 100 percent * from vie_trn_47 order by createdon desc

The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.的更多相关文章

  1. T-SQL Part IV: ORDER BY

    ORDER BY 返回一个Cursor,并不返回结果集.而试图将Cursor作为输入将产生了错误. 所以,下列的SQL语句将产生错误: SELECT VerID, IsComplete VerID, ...

  2. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题 MySQL

    问题:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregate ...

  3. 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contai

    之前一直使用的mysql5,突然换成8之后,有许多地方不一样,今天就碰到一个. 在使用sql语句创建表时,报错:  1055 - Expression #1 of ORDER BY clause is ...

  4. MYSQL---Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column '

    --数据库中插入数据或执行sql语句时一直报下面这个错误: Expression # of ORDER BY clause is not in GROUP BY clause and contains ...

  5. mysql(5.7以上)查询报错:ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by

    执行mysql命令查询时: select * from table_name错误信息如: [Err] 1055 - Expression #1 of ORDER BY clause is not in ...

  6. MySQL [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause

    MySQL[Err]1055 上次MySQL5.7.19主从建立完成之后,所有的测试都是在MySQL命令行下进行的,最近用Navicat Premium进行MySQL的连接,然后在插入数据的时候MyS ...

  7. 解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat

    解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat ...

  8. 解决mysql报错:- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'

    mysql执行报错: - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...

  9. mysql [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GRO

    [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...

随机推荐

  1. IE11 补丁 KB2929437[已过期]

    2014年4月 请更新此补丁 KB2929437 开发人员工具有重要更新 DOM 面板右侧新增 "更改"面板,用于记录调试时修改的 CSS Rules: JS 调试面板,新增 so ...

  2. css五种定位方式介绍

    1.static定位(普通流定位) -------------- 默认定位 2.float定位(浮动定位) 例:float:left; 有两个取值:left(左浮动)和right(右浮动).浮动元素会 ...

  3. Android实现App版本自动更新

    现在很多的App中都会有一个检查版本的功能.例如斗鱼TV App的设置界面下: 当我们点击检查更新的时候,就会向服务器发起版本检测的请求.一般的处理方式是:服务器返回的App版本与当前手机安装的版本号 ...

  4. 文字添加响应事件,js动态加载CSS, js弹出DIV

    文字添加响应事件,js动态加载CSS, js弹出DIV <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&qu ...

  5. UI Framework-1: Aura Gesture Recognizer

    Gesture Recognizer Gesture Recognizer Overview This document describes the process by which Touch Ev ...

  6. Win 7系统倒计时!

    3月25日消息,近日微软已经开始通知当前正在使用Windows 7的用户,该操作系统“接近尾声”.微软表示计划在2020年1月14日终止对Windows 7的所有支持.但结束Windows 7似乎并不 ...

  7. 【Codeforces Round #423 (Div. 2) B】Black Square

    [Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...

  8. java回调方法、钩子方法以及模板方法模式

    在面向对象的语言中,回调则是通过接口或抽象类来实现的,我们把实现这种接口的类称为回调类,回调类的对象称为回调对象,其处理事件的方法叫做回调方法.(摘自百度百科) 那么通过上面那句话将百度百科中的&qu ...

  9. openCV 和GDI画线效率对照

    一. 因为项目须要,原来用GDI做的画线的功能.新的项目中考虑到垮平台的问题.打算用openCV来实现.故此做个效率对照. 二. 2点做一条线,来測试效率. 用了相同的画板大小---256*256的大 ...

  10. BZOJ1306: [CQOI2009]match循环赛

    [传送门:BZOJ1306] 简要题意: 有n个队伍,每个队伍都要和其他队伍比一场,赢了的队得3分,输了的队不得分,打平两队各得一分,给出每个队伍的得分,求出对战方案数 题解: DFS暴搜!!一眼就觉 ...