合并排序???????????????

远程Scada 2005-01-24 10:06:38
(SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*' order by jt desc) union all (SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' order by jt desc)

我的要求是灯芯绒在前按jt排序,仿平绒在后也按jt排序
...全文
102 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Qihua_wu 2005-01-24
  • 打赏
  • 举报
回复
(SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*' order by jt desc)
union all
select * from (SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' order by jt desc)
远程Scada 2005-01-24
  • 打赏
  • 举报
回复
没有看清题意啊
xluzhong 2005-01-24
  • 打赏
  • 举报
回复
SELECT * FROM qiye
where Bigclass='003'
order by title case
when like '*灯芯绒*' then 1
when like '*仿平绒*' then 2
else 3
end,
jt desc
pbsql 2005-01-24
  • 打赏
  • 举报
回复
select * from (SELECT top 100 percent * FROM qiye
where Bigclass='003' and title like '*灯芯绒*' order by jt desc) t1
union all
select * from (SELECT top 100 percent * FROM qiye
where Bigclass='003' and title like '*仿平绒*' order by jt desc) t2
xluzhong 2005-01-24
  • 打赏
  • 举报
回复
SELECT * FROM qiye where Bigclass='003'
order by title case
when '*灯芯绒*' then 1
when '*仿平绒*' then 2
end,
jt desc
daijingjie2002 2005-01-24
  • 打赏
  • 举报
回复
select *,id=case when title like '%灯芯绒%' then 1 when title like '%灯芯绒%' then 2 end from
(SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*' order by jt desc) union all (SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' order by jt desc) as ww order by id
Softlee81307 2005-01-24
  • 打赏
  • 举报
回复
select * from (
SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*'
union all
SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' ) a
order by jt desc
LBYYBL 2005-01-24
  • 打赏
  • 举报
回复
SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*'
union all
SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' order by jt desc
Softlee81307 2005-01-24
  • 打赏
  • 举报
回复
SELECT * FROM qiye where Bigclass='003' and (title like '*灯芯绒*' or title like '*仿平绒*') order by jt desc 就行了

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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