User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 430,118 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,338 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 970 | Replies: 4 | Solved
Reply
Join Date: Nov 2006
Posts: 14
Reputation: kutta_vin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
kutta_vin kutta_vin is offline Offline
Newbie Poster

how to select the upper case values from tables

  #1  
Jun 17th, 2008
Hi friends,

I think the MySql is not case sensitive for selecting values. for example I am having a table called dept,

Id | Depart

1 | BTECH
11 | it
12 | ibt
2 | BE
21 | cse
22 | ece

Now i want to select the capital dept values from dept, but not using the id. how can i achieve it. I tried the following as query ..
select upper(depart) from dept;
but its just converting all values of dept table to capital. that is
it shows as follows
BTECH
IT
IBT
BE
CSE
ECE.
So how can i filter the lower case values to just display the upper case values to look like the following result

Depart

BTECH
BE

please help me if u know the solution.
Last edited by kutta_vin : Jun 17th, 2008 at 12:29 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 812
Reputation: R0bb0b is on a distinguished road 
Rep Power: 2
Solved Threads: 64
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: how to select the upper case values from tables

  #2  
Jun 17th, 2008
try this
CONCAT( UPPER( SUBSTRING( colname, 1, 1 ) ) , LOWER( SUBSTRING( colname, 2 ) ) )
Reply With Quote  
Join Date: Jun 2008
Posts: 59
Reputation: varmadba is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
varmadba varmadba is offline Offline
Junior Poster in Training

Re: how to select the upper case values from tables

  #3  
Jun 18th, 2008
This will also work

select * from table1 where (depart COLLATE latin1_bin )=Upper(depart)
Last edited by varmadba : Jun 18th, 2008 at 2:43 am.
Reply With Quote  
Join Date: Nov 2006
Posts: 14
Reputation: kutta_vin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
kutta_vin kutta_vin is offline Offline
Newbie Poster

Re: how to select the upper case values from tables

  #4  
Jun 20th, 2008
Originally Posted by R0bb0b View Post
try this
CONCAT( UPPER( SUBSTRING( colname, 1, 1 ) ) , LOWER( SUBSTRING( colname, 2 ) ) )



Hello R0bb0b,

Your query doesn't works for me.
Reply With Quote  
Join Date: Nov 2006
Posts: 14
Reputation: kutta_vin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
kutta_vin kutta_vin is offline Offline
Newbie Poster

Re: how to select the upper case values from tables

  #5  
Jun 20th, 2008
Originally Posted by varmadba View Post
This will also work

select * from table1 where (depart COLLATE latin1_bin )=Upper(depart)



Hello varmadba,

Thanks for giving your query, its works for me.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MySQL Forum

All times are GMT -4. The time now is 3:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC