This is a discussion on LCASE() not working on columns. within the MySQL Database forums, part of the Database Forums category; Hi everyone. I am trying to pull everything out of my table using LCASE() like so: SELECT LCASE(`URL`) FROM ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi everyone.
I am trying to pull everything out of my table using LCASE() like so: SELECT LCASE(`URL`) FROM tags LIMIT 10; However, it's not working as I get +---------------------------------------------------------------------------------------------+ | LCASE(`url`) | +---------------------------------------------------------------------------------------------+ | ./home/daz/Desktop/Desktop/From Kaz/2Pac - Ghetto Gospel.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Arrested Development - Everyday People.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Beats International - Dub Be Good To Me.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Brandy & Monica - The Boy Is Mine.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Judge Jules - Sandstorm (original mix) - Darude.wma | | ./home/daz/Desktop/Desktop/From Kaz/Kelly Clarkson - Behind These Hazel Eyes.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Kelly Clarkson - Miss Independent.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Kelly Roland - Stole.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Len - Don't Steal My Sunshine.mp3 | | ./home/daz/Desktop/Desktop/From Kaz/Liberty X Ft Run DMC - Song For Lovers (CD Quality).mp3 | +---------------------------------------------------------------------------------------------+ Is there something I am missing, or another alternative. Basically, I need to use LIKE, but I would like to do everything in lowercase. So rather than 'Dub Be Good To Me' matching only 'Dub Be Good To Me', I want to use 'dub be good to me' and for it to match anything in the database that's the same, regardless of the case. I would appreciate any suggestions. Many thanks. Daz. |
|
|||
|
Daz wrote: > Hi everyone. > > I am trying to pull everything out of my table using LCASE() like so: > > SELECT LCASE(`URL`) FROM tags LIMIT 10; > > However, it's not working as I get > > +---------------------------------------------------------------------------------------------+ > | LCASE(`url`) > | > +---------------------------------------------------------------------------------------------+ > | ./home/daz/Desktop/Desktop/From Kaz/2Pac - Ghetto Gospel.mp3 > | > | ./home/daz/Desktop/Desktop/From Kaz/Arrested Development - Everyday > People.mp3 | > | ./home/daz/Desktop/Desktop/From Kaz/Beats International - Dub Be Good > To Me.mp3 | > | ./home/daz/Desktop/Desktop/From Kaz/Brandy & Monica - The Boy Is > Mine.mp3 | > | ./home/daz/Desktop/Desktop/From Kaz/Judge Jules - Sandstorm (original > mix) - Darude.wma | > | ./home/daz/Desktop/Desktop/From Kaz/Kelly Clarkson - Behind These > Hazel Eyes.mp3 | > | ./home/daz/Desktop/Desktop/From Kaz/Kelly Clarkson - Miss > Independent.mp3 | > | ./home/daz/Desktop/Desktop/From Kaz/Kelly Roland - Stole.mp3 > | > | ./home/daz/Desktop/Desktop/From Kaz/Len - Don't Steal My Sunshine.mp3 > | > | ./home/daz/Desktop/Desktop/From Kaz/Liberty X Ft Run DMC - Song For > Lovers (CD Quality).mp3 | > +---------------------------------------------------------------------------------------------+ > > Is there something I am missing, or another alternative. Basically, I > need to use LIKE, but I would like to do everything in lowercase. So > rather than 'Dub Be Good To Me' matching only 'Dub Be Good To Me', I > want to use 'dub be good to me' and for it to match anything in the > database that's the same, regardless of the case. > > I would appreciate any suggestions. > > Many thanks. > > Daz. Ok, I have just realised that the fields I am trying to use lower on are varbinary(255) fields. Is there any alternative to LCASE() or LOWER(), or should I just do all of this from within a PHP script? Cheers. Daz. |
|
|||
|
Daz wrote: > Ok, I have just realised that the fields I am trying to use lower on > are varbinary(255) fields. Is there any alternative to LCASE() or > LOWER(), or should I just do all of this from within a PHP script? It would appear that I have solved my own problem. I just found that I can use CAST()... So SELECT LOWER(CAST(`url` AS CHAR(255))) FROM tags LIMIT 10; works really well for me. |