distinct
distinct 表示区分,意指检索出来的行是唯一(去重),其放在列的最前面;如果使用了关键字distinct,其作用于后面的所有列
eg:
select distinct expression[,expression...] from tables [where conditions]
如果distinct关键字后面有多个字段时,则会对多个字段进行组合去重,只有多个字段组合起来的值是相等的才会被去重
参考:click
limit
SELECT * from tb_gps_record WHERE 1=1 ORDER BY NULL LIMIT 100;
多排序
SELECT name,age FROM student ORDER BY age DESC, name ASC;
concat
SELECT concat('你好啊',name,'327今天心情怎么样') FROM student WHERE id = '1' ;
sql去空格
SELECT RTRIM(' 哥,huanying ') FROM student WHERE id = '1' ;