yasiraq
09-02-2005, 01:55 AM
HI,
I have a three drop-down menus for City, Area, Zip.
I am using 'like' in my search query which is:
select col_nam from table where city like %txtcity% AND area like %txtarea% AND zip like %txtzip%
But, since AND is being used, if any of the parameter is NOT given, the result is Zero and If I use OR instead, it still not work if only two values are selected. For example,
If a user has selected city: A, area: X , then query using OR will return city matching A, area matching X BUT it will also return the area which should NOT be included.
So, what should be done here. Do you think that 'like' should be used here ?
Or any other suggestion?
Thanks
Yasir
I have a three drop-down menus for City, Area, Zip.
I am using 'like' in my search query which is:
select col_nam from table where city like %txtcity% AND area like %txtarea% AND zip like %txtzip%
But, since AND is being used, if any of the parameter is NOT given, the result is Zero and If I use OR instead, it still not work if only two values are selected. For example,
If a user has selected city: A, area: X , then query using OR will return city matching A, area matching X BUT it will also return the area which should NOT be included.
So, what should be done here. Do you think that 'like' should be used here ?
Or any other suggestion?
Thanks
Yasir