order by CHARINDEX(UID,‘007’) desc
我想要的效果是007在第一行,其他的例如001,002等升序排列,应该怎样写SQL语句呢???
order by charindex
先把007的全部查询出来,在把除007外的按升序排,在组合起来
问题是语句怎么写啊!
select * from t1 where uid='007'
union
select * from t1 where uid<>'007' order by uid asc