SQL query

  neon67 02:28 05 Apr 2003
Locked

I have a table which contains organizations address and the service they provide.
Organization Area Service
A Place1 x y z
B Place2 y

I've managed to write the sql to select records that provide a certain service and in a certain area.
SELECT *
FROM tablename
WHERE services LIKE '%varservices%'
AND Area ='varArea'
ORDER BY Organization ASC

I have a search page which lets users search by service provided and area. Area choices are "place1" "place2" etc.
What I would now like to add to my search is when someone enters "any area" as search parameters it returns all the records. Any help would be appreciated.

  AccessMoron 09:59 05 Apr 2003

The best way would be to build the WHERE statement on the fly.
Check for values in each search field, if its there then add this to the serch, if its not there then go and check the next search option.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 hack: How secure is your Wi-Fi?

Add Depth Of Field to a photo using Tilt Shift Blur in Photoshop

iPhone tips & tricks

Les meilleures tablettes 2017