mysql如何查找字段在區(qū)間范圍內(nèi)的對(duì)應(yīng)
例如:依據(jù)網(wǎng)站會(huì)員積分的區(qū)間條件,查詢各個(gè)條件下的網(wǎng)站會(huì)員個(gè)數(shù)
區(qū)間:小于0,0-3k,3k-6k,6k-8k,8k-1w,1w-5w,5w-10w,大于10w
SELECT ELT( INTERVAL( `integral` , -1000000, 0, 3000, 6000, 8000, 10000, 50000, 100000 ) , '小于0', '0-3k', '3k-6k', '6k-8k', '8k-1w', '1w-5w', '5w-10w', '大于10w' ) AS 區(qū)間, COUNT( `id` ) AS num FROM `user` GROUP BY INTERVAL( `integral` , -1000000, 0, 3000, 6000, 8000, 10000, 50000, 100000 )
*博客內(nèi)容為網(wǎng)友個(gè)人發(fā)布,僅代表博主個(gè)人觀點(diǎn),如有侵權(quán)請(qǐng)聯(lián)系工作人員刪除。
隔離器相關(guān)文章:隔離器原理