首页 > mysql > sql常规变态顺序

sql常规变态顺序

2010年8月1日 effect 发表评论 阅读评论

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 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.