例如有表 table aaa
字段为id title content type
表中的type有两种情况,会员、非会员。我如何让所有会员信息按时间顺序排在非会员后头?
会员 2007-3-13
会员 2007-3-12
会员 2007-3-12
会员 2007-3-11
会员 2007-3-10
非会员 2007-3-13
非会员 2007-3-11
非会员 2007-3-11
非会员 2007-3-11
------解决方案--------------------
order by type desc
------解决方案--------------------
select * from tb where type = '非会员 ' order by 时间
union all
select * from tb where type = '会员 ' order by 时间
------解决方案--------------------
直接order by不就好了吗?只不过把会员类型放前,日期放后……
反正会员类型就2个,不是asc就素desc
------解决方案--------------------
Select * From aaa Order By (Case type When N '会员 ' Then 0 Else 1 End), 时间字段