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 > Filter Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-24-03, 12:05
soap soap is offline
Registered User
 
Join Date: Dec 2003
Posts: 1
Filter Search

Hello,
I know this is a very basic question, so please bear with me.
I've built a search function. There are three parameters. I would like the user to search any one or a combination of these parameters.

The parameters filter the recordset and I do not know how to structure the filters to allow a default set through, depending on the parameter option the user selects.

I know I may need to use "OR" in addition to "AND" to get the result I need.

Here is my SQL:

SELECT Properties.PropertyID, Properties.Name, Properties.TownOrResort, Locations.TownOrResort, Properties.Ranking, Ranking.Ranking, Properties.Photo1, Amenities.Type, Amenities.Bedrooms, Amenities.Sleeps, Properties.DateRange1, Properties.DateRange2, Properties.DateRange3, Properties.DateRange4, Properties.DateRange5, Properties.DateRange6, Properties.PriceRange1, Properties.PriceRange2, Properties.PriceRange3, Properties.PriceRange4, Properties.PriceRange5, Properties.PriceRange6
FROM Properties, Amenities, Locations, Ranking
WHERE ((((Properties.PropertyID = Amenities.PropertyID) AND (Properties.TownOrResort = Locations.LocationID)) AND (Ranking.RankingID = Properties.Ranking)) AND ((Properties.TownOrResort = MMColParam) AND (Amenities.Type = 'MMColParam2')))
ORDER BY 4 ASC, 2 ASC, 6 ASC, 9 ASC

Thanks for any help you can lend.
Reply With Quote
  #2 (permalink)  
Old 12-24-03, 14:43
olerag olerag is offline
Registered User
 
Join Date: Aug 2003
Posts: 40
DEFINE myParam = 'S%';

SELECT * FROM emp WHERE ename LIKE '&myParam'
/

Will extract two records from the scott.emp table, both whose names
begin with the letter 'S'.
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