Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 05-24-2005, 11:45 PM Searching a database
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
What is the best statement to use when searching a table?

Let's say there are 10 columns and i am looking for any occurence of the string 'ee', what is the best way of doing that?

Thanks.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
 
Register now for full access!
Old 05-25-2005, 12:41 AM
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
SELECT STATEMENT.

$sql = mysql_query (" SELECT blash blah WHERE so so = that
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Old 05-25-2005, 01:14 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
select * from mytable where column1 like '%ee%' or column2 like '%ee%' or .... or column10 like '%ee%'
or better
select * from mytable where concat(column1, column2, ... column10) like '%ee%'
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-25-2005, 07:28 AM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Quote:
select * from mytable where concat(column1, column2, ... column10) like '%ee%'
I like that one.

I'll give it a try and get back to you.

p.s. Is that case-sensitive???
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 05-25-2005, 07:42 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
No, it isn't. This will find strings containing either Ee or eE or EE or ee
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-25-2005, 08:12 AM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Any idea on how to get case insensitive?
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 05-25-2005, 07:27 PM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Ok. Apparantley it is possible to do a SELECT using a REGEX:

http://dev.mysql.com/doc/mysql/en/regexp.html

Unfortunately, i still can't understand REGEX properly.

How do i write a case insensitive SELECT statement for a string of characters that can come in the begininng, middle or end of the data?

Merci beaucoup.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 05-25-2005, 08:02 PM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Here it is:

SELECT * FROM column WHERE REGEXP '(ee)'.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Reply     « Reply to Searching a database
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25866 seconds with 12 queries