homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
How to find related items in a no so similar list?
queries, match, mysql
redhatlab




msg:4124812
 4:41 am on Apr 30, 2010 (gmt 0)

Hi,

I have a question about searching in MySQL:

I have a table with 1.5+ million records in only one field plus the auto increment field. The records might seem similar some times, but some others they are not what kind of query I can run to try to find similar items?

Note: I was thinking about LIKE queries or FULL TEXT, but after testing them I found out they are not good.

Thank you

 

rocknbil




msg:4125124
 6:29 pm on Apr 30, 2010 (gmt 0)

what kind of query I can run to try to find similar items?


What aspects of the records make them "similar?"

Items that are the same color, size, or other attributes?

Some part of the actual record that is similar?

Mnemonic similarities, like "here" and "hear" or "to","two," and "too"? (I've always wished for a project in which I could use soundex(). :-)

LifeinAsia




msg:4125128
 6:34 pm on Apr 30, 2010 (gmt 0)

Can you post some examples of what makes the data "similar" to others?

I was thinking about LIKE queries or FULL TEXT, but after testing them I found out they are not good.
What made them "not good?"
redhatlab




msg:4151938
 2:13 pm on Jun 13, 2010 (gmt 0)

Hi,

Sorry for the long delay here is a sample:

FIP2XM8S
FIP30M20
FIP32A11X
FIP32B18Y
FIP3AM12
FIP3AM23
FIP3BM13D
FIP3BM14
FIP3BM22
FIP3BM23

I have been thinking in using PHP to cut the strings and get i.e. the first 3 letters or the last 3 and then run the query.

LifeinAsia




msg:4151971
 5:02 pm on Jun 13, 2010 (gmt 0)

Well, the following would work:
SELECT *
FROM MyTable
WHERE MyField LIKE 'FIP%'

As long as you have an index on MyField, it should run pretty quickly.

If not, then you probably have other more serious problems and you should do further investigation into what's going on with your server (especially if it is shared with other users).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved