Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to filter on multiple fields in SELECT?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

107 Posts

Posted - 03/11/2013 :  07:57:02  Show Profile  Reply with Quote
Hi there,

I am trying to insert a field in my SELECT statement which allows a user to search for something which could be contained in multiple fields.

For example, if a user was to search for enquiries on High Road in the 'Search' field, the 'Search' field should contain site_name, enquiry_location, feature_location, and Feature_ID fields.

The above fields are all CHAR fields. Is there a way to combine all the fields and make it available for a user to search on in a SELECT statement?

If you have suggestions please share

Posting Yak Master

101 Posts

Posted - 03/11/2013 :  08:49:39  Show Profile  Reply with Quote
Are you passing the value in as a parameter?

Not 100% I fully understand what your asking, but can you use an OR in the where clause?
(site_name = @Param OR enquiry_location = @Param OR feature_location = @Param OR Feature_ID fields = @Param)
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000