Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trying to get the word with starting upper case on first letter using mysql

I have

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

i have done like this for getting number of visits by using below query

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

it was giving results like this

                Status          Visits
                accepted         2
                refused          4

can i get the results like this

                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)

I am using mysql work bench

like image 271
user682417 Avatar asked Jan 19 '23 04:01

user682417


1 Answers

u can use SUBSTRING and UPPER

select CONCAT(UPPER(SUBSTRING(visit_Status, 1, 1)), 
      LOWER(SUBSTRING(visit_Status FROM 2))) as Status ......
like image 94
Haim Evgi Avatar answered Jan 22 '23 01:01

Haim Evgi