asp里面的一个sql语句

weblogical 2006-07-17 04:53:31
一个存放医生的表(expert),字段有科室编号(section_office)、sort(人为给的序号),前三名按照sort排序,后面的按照科室排序(科室1的在一块,然后是科室2,依次类推……),我的这个语句不能解决问题。select * from expert where expert_sh=1 order by sort,section_office,该怎么写呢?
...全文
72 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sibyle 2006-07-17
  • 打赏
  • 举报
回复
当然有错union all 只能最后一个Select用Order BY  

weblogical 2006-07-17
  • 打赏
  • 举报
回复
楼上的
服务器: 消息 156,级别 15,状态 1,行 2
在关键字 'union' 附近有语法错误。
kencorn 2006-07-17
  • 打赏
  • 举报
回复
select top 3 * from expert where expert_sh=1 order by sort
union all
select * from expert where expert_sh=1 order by section_office


这样写有个缺点会有重复

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧