在不排序情况下
select top 5 * from table where nid=1
union all
select top 10 * from table where nid=2
这个sql语句能运行
select top 5 * from table where nid=1 order by id desc
union all
select top 10 * from table where nid=2 order by id desc
排序就不能正确运行求 怎么改成在排序下也能运行
select top 5 * from table where nid=1
union all
select top 10 * from table where nid=2
这个sql语句能运行
select top 5 * from table where nid=1 order by id desc
union all
select top 10 * from table where nid=2 order by id desc
排序就不能正确运行求 怎么改成在排序下也能运行
解决方案 »
- 提示DataDataSource(object)并非所有代码路径都返回值
- 一段代码导致内存溢出,求助!
- CSS继承问题求助
- 正则提取的问题!高手指点下
- 请问,frontpage2003现在升级成什么了,还是frontpage200x吗?
- gridview 标题问题
- server 2003 sp2的服务器上无法远程连接mssql2005,求解答
- ORA-02041: client database did not begin a transaction
- 原来的html 中的 <form></form> 内的提交按钮会触发 onSubmit="return psSearchAdvSubmit”,可是我现在在 .net里如何实现呢?
- 自定义模板问题,请版主帮下忙吧!!
- 如何让jquery异步执行第二次也有效?
- 不绑定控件,如何实现页面调用数据库内容
union all
select * from (select top 10 * from ............)
select top 5 * from table where nid=1
union all
select top 10 * from table where nid=2)a
order by id desc
即:
select top 5 * from table where nid=1
union all
select top 10 * from table where nid=2 order by id desc像下面这样是不对的
select A,B from t1
union all
select A,D from t2 order by A,D