gpt4 book ai didi

mysql - 尝试使用mysql在第一个字母上以大写开头的单词

转载 作者:可可西里 更新时间:2023-11-01 07:19:12 25 4
gpt4 key购买 nike

我有

              Visit table 
Visit_Id
Visit_Date values(09-09-2011)
Visit_status values like (accepted , refused)
member_Id

我这样做是为了获得访问次数通过使用下面的查询

SELECT visit_Status as Status, COUNT('x') AS Visits
FROM visits
WHERE visit_Date BETWEEN '2011-06-20' AND '2011-07-20'
GROUP BY visit_Status

结果是这样的

                Status          Visits
accepted 2
refused 4

我能得到这样的结果吗

                Status          Visits

Accepted 2
Refused 4


with upper case letter on first letter of status i mean like this ( Accepted , Refused) instead of this one (accepted , refused)

我正在使用 mysql 工作台

最佳答案

你可以使用SUBSTRINGUPPER

select CONCAT(UPPER(SUBSTRING(visit_Status, 1, 1)), 
LOWER(SUBSTRING(visit_Status FROM 2))) as Status ......

关于mysql - 尝试使用mysql在第一个字母上以大写开头的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6760665/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com