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