| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-01 : 08:01:14
|
| Pete writes "I should start off by noting that i am very new to ASP, so what i am asking may be very simple. I have searched around and tried quite a few things and can't seem to get it to work so i thought i would ask. I followed closely http://www.sqlteam.com/item.asp?ItemID=2652 to create a query that will parse out terms by spaces, not commas. Now, i have some terms, such as and, of, in, the etc that i do not want included in the result set. I tried using where not, not in, and other ideas in many combinations. I am sure I have overlooked something, but just can't seem to figure out what. The query is below. It is currently functioning well, aside from the unwanted results, on mssql server 2000, advanced server 2k. SELECT top 50 NullIf(SubString(' ' + searchstring + ' ' , ID , CharIndex(' ' , ' ' + searchstring + ' ' , ID) - ID) , '')as Term, COUNT(NullIf(SubString(' ' + searchstring + ' ' , ID , CharIndex(' ' , ' ' + searchstring + ' ' , ID) - ID) , '')) as # FROM Tally, searchLog WHERE ID <= Len(' ' + searchstring + ' ') AND SubString(' ' + searchstring + ' ' , ID - 1, 1) = ' ' AND CharIndex(' ' , ' ' + searchstring + ' ' , ID) - ID > 0 Group by NullIf(SubString(' ' + searchstring + ' ' , ID , CharIndex(' ' , ' ' + searchstring + ' ' , ID) - ID) , '') Order by # descHopefully you can help me sort this out, probably in about 10 seconds. Thanks. " |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-07-01 : 19:49:55
|
| And you tried addingAND (NullIf(SubString(' ' + searchstring + ' ' , ID , CharIndex(' ' , ' ' + searchstring + ' ' , ID) - ID) , '') NOT IN ('and','of','in','the','etc'))to your where clause?--I hope that when I die someone will say of me "That guy sure owed me a lot of money"Edited by - rrb on 07/01/2002 19:50:14 |
 |
|
|
|
|
|