I am working on selecting data according to 3 basic condition which is not the issue,the issue is that if 1st condition satisfied then it should not consider the rest two conditions just like if else but if the 1st condition is false then it goes to 2nd only not to 3rd one just like if elseif and if first two conditions not satisfied then it will consider the 3rd only.
But in mysql when i use OR & AND then it is considering all 3 conditions at a time.
Like this:-
SELECT * FROM `table` WHERE 'main-condition' and ('1st condition' or '2nd condition' or '3rd condition');
After this i also tried with IF in where clause but it also give the same result like OR.
Code:-
SELECT * FROM `table` WHERE 'main-condition' and (IF('1st condition',true,IF('2nd condition',true,IF('3rd condition',true,false))));
Actual Query:-
SELECT 'filter','car-name' FROM `car` WHERE (((`id` = ? and `type` = 'car')and(IF((find_in_set('new car',`filter`) > 0),true,IF((find_in_set('new',`filter`) > 0, true,if((`filter`=""),true,false))))));
It give output
But i need output like this
If any one knows how to handle this type of query then please answer me.
Thanks