If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > search function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-04, 11:27
HopeMod HopeMod is offline
Registered User
 
Join Date: Jan 2004
Posts: 5
search function

I want to take text from a user and have it search for some or part of what they enter with colums in 2 or more tables?

Can it be done? If yes can someone point me in the right direction?
Reply With Quote
  #2 (permalink)  
Old 01-16-04, 11:35
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Specific post can be more helpful.
Reply With Quote
  #3 (permalink)  
Old 01-16-04, 12:45
HopeMod HopeMod is offline
Registered User
 
Join Date: Jan 2004
Posts: 5
More Specific On SQL search

I think I need to take the text that someone put in a web form and then break it up so I can search for any one of those words in a SQL statment. I need help in how to get sql to go though that and put them all together in one query? Any idea?

This is what I have now and I know it is not even close:

SELECT distinct list_company, List_state, list_address_1, LIST_CITY, LIST_PHONE_1, LIST_EMAIL
FROM master_list, category where master_list.list_company like '%#advfind#%' or master_list.List_state like '%#advfind#%' or master_list.List_address_1 like '%#advfind#%' order by List_Company
Reply With Quote
  #4 (permalink)  
Old 01-16-04, 13:08
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
What is your database? MSSQL or MS Access?
Reply With Quote
  #5 (permalink)  
Old 01-16-04, 13:13
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
In ASP code, you can use Split(expression, delimiter) to seperate the string which user types in. When you get the keywords (in array), you need a For loop and then add all keywords into WHERE clause.
Reply With Quote
  #6 (permalink)  
Old 01-16-04, 13:13
HopeMod HopeMod is offline
Registered User
 
Join Date: Jan 2004
Posts: 5
SQL Server 2000
Reply With Quote
  #7 (permalink)  
Old 01-16-04, 13:14
HopeMod HopeMod is offline
Registered User
 
Join Date: Jan 2004
Posts: 5
Coldfusion

You know coldsufion?
Reply With Quote
  #8 (permalink)  
Old 01-16-04, 13:14
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Re: Coldfusion

Quote:
Originally posted by HopeMod
You know coldsufion?
Why did you use "#" in your WHERE clause? Okay, I know why because of coldsufion. I know a little.

Last edited by gyuan; 01-16-04 at 13:17.
Reply With Quote
  #9 (permalink)  
Old 01-16-04, 13:17
HopeMod HopeMod is offline
Registered User
 
Join Date: Jan 2004
Posts: 5
Re: Coldfusion

Because the person askig for this search funtion is using Coldfusion
Reply With Quote
  #10 (permalink)  
Old 01-16-04, 13:20
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
After you get keywords from the string that use enters in the form, you can do a loop and then add the keywords in WHERE clause.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On