
mysql
阿·成
热爱编程
展开
-
Mysql之LEFT JOIN,RIGHT JOIN,INNER JOIN
现有a,b两表 a表数据 b表数据 a表数据 b表数据sql:// 1SELECT a.* FROM a aLEFT JOIN b b ON (b...原创 2021-08-11 16:05:11 · 12575 阅读 · 0 评论 -
Mysql获取分组中最大值
eg:现需求,一张表,我需要取不同性别中年龄最大的人,如下表所示select temp.* from (select distinct pp.id as tempId, pp.sex AS sex,pp.age from test001 pp order by pp.age desc ) temp group by sex;这样写就可以实现,也不知道有没有更简单的办法,我不知道为啥加上 distinct 就可以查询出正确结果,不加的话就不行,希望有懂的大佬解读下...原创 2021-07-08 10:11:53 · 14226 阅读 · 4 评论 -
mysql查询某个表有哪些字段
select COLUMN_NAME from information_schema.COLUMNS where table_name = '要查询表的名字';原创 2021-06-25 09:25:59 · 13933 阅读 · 0 评论