sql常规变态顺序
SELECT id, concat( ‘,’, id, ‘,’ ) AS test, substring_index( concat(‘,’,replace( ‘7,4,12,6,3,2′, ‘,’, ‘,,’ ),’,') , concat( ‘,’, id, ‘,’ ), 1 )
FROM `tablename`
WHERE id
IN ( 7, 4, 12, 6, 3, 2 )
ORDER BY substring_index( concat(‘,’,replace( ‘7,4,12,6,3,2′, ‘,’, ‘,,’ ),’,') , concat( ‘,’, id, ‘,’ ), 1 ) ;
谁能看明白 哈哈哈哈哈
感谢同事老王
分类: mysql