当前位置: 代码迷 >> Sql Server >> mysql条件 罗选表 符合条件的居前显示 不符合条件的在后面显示 居前和居后的都有自己的排序
  详细解决方案

mysql条件 罗选表 符合条件的居前显示 不符合条件的在后面显示 居前和居后的都有自己的排序

热度:25   发布时间:2016-04-25 00:33:58.0
mysql条件 筛选表 符合条件的居前显示 不符合条件的在后面显示 居前和居后的都有自己的排序
筛选表 符合条件的居前显示 不符合条件的在后面显示  居前和居后的都有自己的排序

如;
/*************

得到未过期的数据行
select t.* from v_shop_data_type t  isFlag=1 order by publishTime

得到已过期的数据行
select t.* from v_shop_data_type t  isFlag=0 order by publishTime

************/

这两个查询如何合成一张表,未过期的在前面显示,已过期的在后面显示
有高手知道没,,,万分感谢

------解决方案--------------------
select t.* from v_shop_data_type t order by isFlag desc,publishTime
------解决方案--------------------
select t.* from v_shop_data_type t order by isFlag desc,publishTime

------解决方案--------------------
select t.* from v_shop_data_type t  isFlag=1
union all
select t.* from v_shop_data_type t  isFlag=0 
order by isFlag, publishTime
  相关解决方案