the user can also enter only one of the three parameters or two so its not required to enter the three values
This UI design simply suggests that the values are not uniquely linked and you can get one or more results if you select the search criteria.
When, this is the case, you need to:
1. Change the query with
LIKE
instead of '
=
'.
2. Make sure you put a '%' append to the search criteria values before assigning it to the parameters of query.
Thus, if you give 'Work_Flow_ID' = 3, then put @workflowid = "%3%";
=> if you select nothing for JOB_ID, then it will pass @jobid= "%%";
SELECT
applicants.name
FROM
Interview_Schedule
INNER JOIN
applicants ON Interview_Schedule.app_id = applicants.id
WHERE
Interview_Schedule.work_flow_id LIKE @worflowid
AND
Interview_Schedule.interview_district LIKE @distid
AND
Interview_Schedule.Job_ID LIKE @jobid
P.S.: Above changes
does not ensure you a single unique record. In order to make that sure, you need to make atleast one field mandatory.