日期:2014-05-18 浏览次数:20480 次
select * from batch_trx o where o.bat_id in ('HB11BAGBBB','HB11BAGBBA','HB115AEBAA','HB10HA2DCB') order by charindex(o.bat_id,'HB11BAGBBB','HB11BAGBBA','HB115AEBAA','HB10HA2DCB')
------解决方案--------------------
--> 测试数据:[test] if object_id('[test]') is not null drop table [test] create table [test](id varchar(10)) insert [test] select 'HB10HA2DCB' union all select 'HB115AEBAA' union all select 'HB11BAGBBA' union all select 'HB11BAGBBB' select * from test order by id desc /* id HB11BAGBBB HB11BAGBBA HB115AEBAA HB10HA2DCB */ --这么不行么?
------解决方案--------------------
select * from batch_trx o where o.bat_id in ('HB11BAGBBB','HB11BAGBBA','HB115AEBAA','HB10HA2DCB') ORDER BY GETDATE()