Resend my activation email : Register : Log in 
BCF: Bike Chat Forums


More SQL.....

Reply to topic
Bike Chat Forums Index -> The Geek Zone
View previous topic : View next topic  
Author Message

AcIdBuRnZ
World Chat Champion



Joined: 28 Jul 2003
Karma :

PostPosted: 20:14 - 23 Mar 2006    Post subject: More SQL..... Reply with quote

Ok,

Now I have my query problems resolved, here's another one for you lot.....

How can you perform 'fuzzy' searches?

What I am really looking for is something like this:

If you search for jumper, it will return all records containing words like jumpers, jumping, jump etc

Just so when people search they get more results back, rather than exactly what they typed in.

As you can tell my SQL is a little rusty (and pretty basic) so just need a little guidance here.

Thanks Smile
____________________
Past: Honda NSR125R >> Kawasaki ER-5a2 >> Kawasaki ZZR-600e1 >> Suzuki GSXR-750Y >> Honda VTR 1000 Firestorm
"Chickity China the Chinese Chicken..."
 Back to top
View user's profile Send private message Send e-mail Visit poster's website You must be logged in to rate posts

BigChris
Spanner Monkey



Joined: 25 May 2005
Karma :

PostPosted: 20:27 - 23 Mar 2006    Post subject: Reply with quote

use wildcards in the select statement when doing the query:

select * from sales_table where query = "*jumper*";

My SQL is rusty too, but wildcards can be used. Just cant remember if its a * or a &
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

Kickstart
The Oracle



Joined: 04 Feb 2002
Karma :

PostPosted: 22:30 - 23 Mar 2006    Post subject: Reply with quote

Hi

"%" is the normal wildcard for multiple characters. "*" is the one used by the Microsoft attempts at SQL.

All the best

Keith
____________________
Traxpics, track day and racing photographs - Bimota Forum - Bike performance / thrust graphs for choosing gearing
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

Suzuki
Roger



Joined: 03 May 2005
Karma :

PostPosted: 10:01 - 24 Mar 2006    Post subject: Reply with quote

Wildcards wont allow you to search for "jumper" and find "jumping" though. Wink

The answer to this is to have a 'fuzzy' table. ie, a row in the table which maps words onto similar search words.

So, 'jumper' would map to the collection of words, 'jumper', 'jump', 'jumping', etc.

Then you perform your search with all of the associated words.

If you're really clever, you'll get your fuzzy table to learn new words as people search for them. That's quite tough though. Wink
____________________
<Simple> no I'm shaven Jon Razz
<Simple> it is a big enough hole.. I'll leave it now
Ride: 1999 Suzuki GSXR600 (yellow/black) IRC: Stats - Relationship Map
 Back to top
View user's profile Send private message Send e-mail Visit poster's website You must be logged in to rate posts

AcIdBuRnZ
World Chat Champion



Joined: 28 Jul 2003
Karma :

PostPosted: 12:59 - 24 Mar 2006    Post subject: Reply with quote

Interesting.

Thanks for replies guys.

Will try using the wildcards. But, TBH, I think rather than allowing users to enter a search string, I'll just give drop down menus so they can select categories, and display results that way.

Much easier to code, and user can see exactly what wil be displayed Smile

Cheers,

Mark
____________________
Past: Honda NSR125R >> Kawasaki ER-5a2 >> Kawasaki ZZR-600e1 >> Suzuki GSXR-750Y >> Honda VTR 1000 Firestorm
"Chickity China the Chinese Chicken..."
 Back to top
View user's profile Send private message Send e-mail Visit poster's website You must be logged in to rate posts

ali-b
Trackday Trickster



Joined: 19 May 2005
Karma :

PostPosted: 14:18 - 24 Mar 2006    Post subject: Reply with quote

You can do a dictionary search for the root word (so jumper would yield jump) and then do a :-

'select * from my_table where my_column like '%my_rootword%'

The first % is, I guess, optional and you'd get faster results if you didn't use it, but as you used the word jumper it would get results back like 'polo neck jumper' with that syntax

You can use % in MS SQL, it helps to stick to standards to aid portability. Most new implementations use both (because they were dumb and tried to change the standard early on, some people moaned and some people used it so now they have to use both for compatibility)

HTH

A.
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts
Old Thread Alert!

The last post was made 18 years, 36 days ago. Instead of replying here, would creating a new thread be more useful?
  Display posts from previous:   
This page may contain affiliate links, which means we may earn a small commission if a visitor clicks through and makes a purchase. By clicking on an affiliate link, you accept that third-party cookies will be set.

Post new topic   Reply to topic    Bike Chat Forums Index -> The Geek Zone All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Read the Terms of Use! - Powered by phpBB © phpBB Group
 

Debug Mode: ON - Server: birks (www) - Page Generation Time: 0.06 Sec - Server Load: 0.9 - MySQL Queries: 17 - Page Size: 53.72 Kb