在这里,你哥们!
SET @counter = 0;SET @category = '';SELECt *FROM( SELECt @counter := IF(data.category = @category, @counter+1, 0) AS counter, @category := data.category, data.* FROM ( SELECt * FROM test ORDER BY category, date DESC ) data) dataHAVINg counter < 2
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)