473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

no results in WHERE LIKE without capital

137 100+
Hello!
I have this query but it only works if the first letter is a capital.

This is the query:
Expand|Select|Wrap|Line Numbers
  1. SELECT id, companyname, city FROM crediteuren 
  2. WHERE ( companyname LIKE '%Someon%' ) OR (city LIKE '%Someon%' )
  3. ORDER BY companyname
And this doesn't work....:
Expand|Select|Wrap|Line Numbers
  1. SELECT id, companyname, city FROM crediteuren 
  2. WHERE ( companyname LIKE '%someon%' ) OR (city LIKE '%someon%' )
  3. ORDER BY companyname
I realy don't get it....
Thanks in advance!

Paul
Jun 23 '11 #1
5 2571
code green
1,726 Expert 1GB
The fields in question are not CHAR, VARCHAR or TEXT.
Or it is the collation - using a character set which is case sensitive.
I don't fully understand collation but I always makes sure table and fields are latin1
Jun 24 '11 #2
mwasif
802 Expert 512MB
It looks like you are using case sensitive collation. Provide the output of the following query so that we can suggest you something

Expand|Select|Wrap|Line Numbers
  1. DESC crediteuren;
Jun 24 '11 #3
nathj
938 Expert 512MB
If it is case sesitivity and you want to maintain that then you could use something like:
Expand|Select|Wrap|Line Numbers
  1.     SELECT id, companyname, city FROM crediteuren 
  2.     WHERE ( LOWER(companyname) LIKE '%someon%' ) OR (LOWER(city) LIKE '%someon%' )
  3.     ORDER BY companyname
  4.  
There is also an UPPER() function that could be used.

Hope that helps
nathj
Jun 30 '11 #4
djpaul
137 100+
Well, it was the collation.
1 column was set to latin and the other was set to (i think is was..) latin1_ch
Changed to latin1 and it worked!

Thanks!
Jul 8 '11 #5
Atli
5,058 Expert 4TB
@nathj

You can also just specify which COLLATE to use, instead of manipulating the string like that.
Expand|Select|Wrap|Line Numbers
  1. SELECT ...
  2. WHERE col1 LIKE '%something%' COLLATE latin1_general_ci
  3. OR    col2 LIKE '%something%' COLLATE latin1_general_cs;
  4.  
There the first column would be search using the case-insensitive latin1 collation, but the second one using the case-sensitive version.
Jul 8 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Matthias | last post by:
Hi, I felt it would be about time to get a copy of the C++ Standard. I browsed www.iso.org and searched for C++ -- 0 results. Where can I buy it? -- Regards, Matthias
2
by: Phillip Parr | last post by:
Hey all, I'm probably just having a lax moment but I can't quite figure this out. Say I have a table such as this: friends user friend 1 2 1 3 2 4 2 1
6
by: C L Humphreys | last post by:
Hi, Is it possible for fields in a table to have an effect on the results of a query which does not directly use those fields? To explain, I use this query Select * from addresses where...
4
by: Darryl Kerkeslager | last post by:
I'm trying to construct a simple query (Hah! then why can't I figure it out if it's so simple?) that totals the results where the drug test results are True, negative being treated like any other...
82
by: zardoz | last post by:
I've got this problem: unsigned long long lTemp; char cLargeNum="1324567890"; sscanf(clargeNum,"%llu",&lTemp); which under Win32 isn't working*. My program needs to compile under posix so...
2
by: Matt Michael | last post by:
I'm using ADO .NET to connect to a Microsoft Access database, and everything so far has been working in my program except one small problem. I am constructing a query string to search for certain...
4
by: Henry Combrinck | last post by:
Hello Searched around, but could not find this mentioned. I've noticed the following behaviour in 7.4.5: select * from foo where col1 = 1 or col1 = 2 or col1 = 3 or
8
by: GS | last post by:
Guys: I have a question, Is it possible to implement pop-up window without Java script, we don't want to use java script since it might get blocked by pop-up blocker. Thanks in advance. GS.
10
by: Lloyd Harold | last post by:
I'm very new to PHP and attempting to put together a simple script for retrieving MySQL data of personal records. The MySQL table I'm using consists of: 0: id 1: name 2: location (an integer...
11
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.