SQL语句按in排序
根究需求 需要在in里面排序
sqlserver写法:
select h.pk_timeitem,h.timeitemcode,h.timeitemname,h.timeitemname2,b.pk_timeitemcopy from tbm_timeitem h
left join tbm_timeitemcopy b on b.pk_timeitem = h.pk_timeitem where b.enablestate='2' and h.enablestate='2'
and h.itemtype='0' and b.pk_org ='pk_org'
and timeitemcode in('105','NP','119','PSLHK','115')
ORDER BY CHARINDEX(','+timeitemcode+',',',105,NP,119,PSLHK,115,')"
人生是一场难得的修行,不要轻易交白卷。
----与君共勉