MySQL dense rank for each group/partition
问题 I am trying to build a dense rank kind of functionality but not exactly dense rank. I want to rank each group but within each group I want to keep the rank same for same values. I've written the following query which gives me a dense rank kind of functionality SELECT id, item_code @curRank := @curRank + 1 AS rank FROM table t, (SELECT @curRank := 0) r WHERE <several filters> Whereas, I want this The closest question I found is this one MySQL give a rank to each group Please help. 回答1: You can