测试必备的Mysql常用sql语句,每天敲一篇,每次敲三遍,每月一循环,全都可记住!!
https://www.cnblogs.com/poloyy/category/1683347.html
需要注意,创建数据库和创建表的语句博文都在前面哦
整个系列都是相互关联的哈,需要用到前面创建的数据库和表哦(系列博文第一篇和第二篇)
当使用distinct的时候,只会返回指定的字段,其他字段都不会返回,所以查询语句就变成去重查询语句
常见使用场景:
SELECT DISTINCT <字段名>,<字段名>, FROM <表名>;
select distinct age from yyTest;
select distinct sex,age from yyTest;
select count(distinct age) from yyTest;
select username,distinct age from yyTest; select distinct age,distinct username from yyTest;
Mysql常用sql语句(四)- distinct 去重数据
原文:https://www.cnblogs.com/poloyy/p/12858404.html