By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

Anti-Query

P: n/a
I'm writing a program that has an auto spelling correction feature. it is
kind of like google and ebay's spelling suggestion features (did you mean?:
correctly spelled word)
I need to write a sql query that does partial match, which is the exact
opposite as how you would do a wild card search.

Wildcard search example
---
Select id from table1 where message like 'i%like%food%'
--
it would yield results like these
"i like mexican food"
"i don't like this food"
"i like food in general"
>>>>>>>>>>>>>>>>>>>>

WHAT I NEED TO DO
I need to do the exact opposite of the example above
this is what i have in the database.
ID(autonumber) keywords(varchar)
---------------- --------------------
1 i%like%food%
2 i%like%sports%
3 i%like%computers%
and so on
What I would like to do is to input these sentences and get an output of the
wild card.
---pseudo code---
select id from table1 where keywords like 'i like food in general'
---
results:
'i%like%food%'
i hope this makes sense

Thanks in advance,

Aaron
Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If I understand you correct... SELECT id From table1 WHERE Message
LIKE(MessageColumn, ' ' , '%')

However, I'm not sure what this would accomplish so I am probably not
understanding the goal. If your actual query was select id from table1
where keywords like 'i like food in general'

You want it returned with % instead of spaces?
"Aaron" <ku*****@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm writing a program that has an auto spelling correction feature. it is
kind of like google and ebay's spelling suggestion features (did you mean?: correctly spelled word)
I need to write a sql query that does partial match, which is the exact
opposite as how you would do a wild card search.

Wildcard search example
---
Select id from table1 where message like 'i%like%food%'
--
it would yield results like these
"i like mexican food"
"i don't like this food"
"i like food in general"
>>>>>>>>>>>>>>>>>>>>>
WHAT I NEED TO DO
I need to do the exact opposite of the example above
this is what i have in the database.
ID(autonumber) keywords(varchar)
---------------- --------------------
1 i%like%food%
2 i%like%sports%
3 i%like%computers%
and so on
What I would like to do is to input these sentences and get an output of

the wild card.
---pseudo code---
select id from table1 where keywords like 'i like food in general'
---
results:
'i%like%food%'
i hope this makes sense

Thanks in advance,

Aaron

Nov 22 '05 #2

P: n/a
No that was not the query, it was only a example, everything after the WHERE
clause is fake.

say the user type in 'i like food in general'. the search engine would look
for this string a the keyword column.

the keyword column has records like

'a%apple%'
'a%airpline%'
'i%like%food%'

it would return 'i%like%food%' as result.

Thanks
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
If I understand you correct... SELECT id From table1 WHERE Message
LIKE(MessageColumn, ' ' , '%')

However, I'm not sure what this would accomplish so I am probably not
understanding the goal. If your actual query was select id from table1
where keywords like 'i like food in general'

You want it returned with % instead of spaces?
"Aaron" <ku*****@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm writing a program that has an auto spelling correction feature. it is kind of like google and ebay's spelling suggestion features (did you

mean?:
correctly spelled word)
I need to write a sql query that does partial match, which is the exact
opposite as how you would do a wild card search.

Wildcard search example
---
Select id from table1 where message like 'i%like%food%'
--
it would yield results like these
"i like mexican food"
"i don't like this food"
"i like food in general"
>>>>>>>>>>>>>>>>>>>>>>>

WHAT I NEED TO DO
I need to do the exact opposite of the example above
this is what i have in the database.
ID(autonumber) keywords(varchar)
---------------- --------------------
1 i%like%food%
2 i%like%sports%
3 i%like%computers%
and so on
What I would like to do is to input these sentences and get an output of

the
wild card.
---pseudo code---
select id from table1 where keywords like 'i like food in general'
---
results:
'i%like%food%'
i hope this makes sense

Thanks in advance,

Aaron


Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.