Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dreamweaver search query

Status
Not open for further replies.

dinster

Programmer
Apr 12, 2007
54
GB
Hi everyone am trying to create a search query but using 2 parameters....surname or hospital no....

How do i tell it to ignore one of the fields if its empty?

What i mean is if enter the surname ....then i only want to filter it by surname and not hospital no...if nothing is written in there...

this is what i got so far

SELECT *
FROM tbl_METOBS
WHERE Surname = ? or HospitalNo = ?


What it does is ....if i enter the surname and nothing in the hospitalno....it will give me result with the filter of surname and also include records who dont have a HospitalNo.

What i want is search one or the other if filled in?

regards

farouq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top