mysql中給查詢結果添加序號列

今天同事給了一個小需求,從一個存有不定數量座標數據的表(map_trace)中每隔20條取一條。最後寫了下面這條SQL:   select * from (select @n:[email protected]+1 as n, a.* from (select * from map_trace order by CREATE_time desc)a,(select @n:=0)b)c where
相關文章
相關標籤/搜索