select * from t1 where pid in(...)排序问题
我的表   t1   为:   
 ID(主键)      pid 
 1                              1 
 2                              2 
 3                              3 
 4                              4 
 5                              5 
 6                              6 
 7                              7 
 8                              8   
 我的语句:   select   *   from   t1   where   pid   in(7,6,2,5);   
 返回的值为:   
                2            2 
                5            5 
                6            6 
                7            7   
 请问如果我想按照   in(7,6,2,5)的顺序返回值,该如何写呢?   
 预期效果:   
             7         7 
             6         6 
             2         2 
             5         5
------解决方案--------------------select * from t1 where pid in(7,6,2,5) 
 order by charindex( ', '+rtrim(pid)+ ', ', ',7,6,2,5, ')