日期:2014-05-18 浏览次数:20494 次
order by charindex(','+ltrim(id)+',', ',3,2,4,1,')
------解决方案--------------------
declrae @str varchar(100)
set @str=''
select @str=@str+','+ltrim(id) from tbla
select * from tblb
where id in(select id from tbla)
order by charindex(','+ltrim(id),@str)
------解决方案--------------------
select * from A where id in (3,2,4,1) order by charindex( ',' + cast(id as varchar) + ',' , ',3,2,4,1,')