![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
sohelcsc (AT) yahoo (DOT) com (Leader) wrote in message news:<b1a93c73.0307290019.5036cc24 (AT) posting (DOT) google.com>... HI, i got a problem while using StrConv function of MS Access in MySQL. My requirement is:- suppose in a name field i have "jhon smith" Now i want to run a sql which will give me the result like "Jhon Smith"--which means upper case first. Now i am running a query like below which is giving me "Jhon smith" but i want "Jhon Smith". SELECT [CustomerID] ,upper(left(firstname,1)) + lower(right(firstname, len(firstname)-1)) AS [FirstName_] from my_table; But the above query is not giving me the right result. Please suggest... Thanks Hoque In general I would say that it is better to keep firstname and lastname in different columns. I assume this is not an option for you so you might try: select upper(substr(name,1,1)) || -- begin firstname lower(substr(name,2,locate(' ',name)-2)) || -- end firstname ' ' || upper(substr(name,locate(' ',name)+1,1)) || -- begin lastname lower(substr(name,locate(' ',name)+2)) -- end lastname from mytable Note that this does not handle names like 'Edgar Alan Poe' nor names like 'Prince' HTH /Lennart |
![]() |
| Thread Tools | |
| Display Modes | |
| |