MySQL查询中包含聚合函数,需要排序, SQL语句应该怎么写?

MySQL查询中包含聚合函数,需要排序, SQL语句应该怎么写?,第1张

select Aname,Asum,Bzong from (select name, sum(xiaoshou) as sum from shujv group by name) A

inner join (select name,zong from shujv order by month desc Limit 1) B

on Aname=Bname

你试一下这个怎么样:

MySQL字符串大小写转换需要用到MySQL字符串大小写转换函数,MySQL 字符串大小写转化函数有两对: lower(), uppper() 和 lcase(), ucase():

mysql> select lower('DDD');

+--------------+

| lower('DDD') |

+--------------+

| ddd |

+--------------+

mysql> select upper('ddd');

+--------------+

|upper('ddd') |

+--------------+

| DDD |

+--------------+

mysql> select lcase('DDD');

+--------------+

| lcase('DDD') |

+--------------+

| ddd |

+--------------+

mysql> select ucase('ddd');

+--------------+

| ucase('ddd') |

+--------------+

| DDD |

+--------------+

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/11676318.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存