我正在使用这个查询:
SELECT A.place_idx,A.place_id,B.TOTAL_CNT,(@r := @r + 1) AS rank FROM CUSTOM_LIST
AS A
INNER JOIN
(SELECT @r := 0)
AS C
INNER JOIN
(SELECT place_id,COUNT(place_id) AS TOTAL_CNT from COUNT_TABLE GROUP BY place_id)
AS B ON B.place_id=A.place_id order by B.TOTAL_CNT desc;
这给出了这个结果:
但我想要这个结果:
我需要如何修改我的查询?我究竟做错了什么?