今天同事给了一个小需求,从一个存有不定数量坐标数据的表(map_trace)中每隔20条取一条.最后写了下面这条SQL: select * from (select @n:=@n+1 as n, a.* from (select * from map_trace order by CREATE_time desc)a,(select @n:=0)b)c where c.n%20<2 and c.n%20!=0; 在此复习下相关知识: 生成一个字段(非表中字段)用以记录排序 (类比为oracle数
1.concat()函数 2.concat_ws()函数 3.group_concat()函数 操作的table select * from test_concat order by id limit 5; 1.concat()函数 功能:将多个字符串连接成一个字符串. 语法:concat(str1, str2,...),返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为null. 3.举例: select concat(area,fr,best_history_data)