How to use like query with multiple column

220 Views Asked by At

We are filtering our record based on two columns group_is and enumeration. We have total 8 groups and 12 enumerations. while processing a filtration for record as group_is like Group 1 and enumeration like Enumeration 1. we get the result which contains all record with group_is like Group 1 and Enumeration like Enumeration 1 as well as enumeration like Enumeration 10,Enumeration 11 and Enumeration 12 also as we have used like in our query. We have used following query in order to get result.

$query = "SELECT * FROM geodata WHERE group_is like 'Group 1%' 
and enumeration like 'Enumeration 1%'";

as we have many other filtration with group and enumerations like batch,site and many other that's why it is important to use like query while processing.

how we can alter query so that we will get result which are only there in Group 1 and Enumeration 1

What we have tried?

we try change our query little bit by changing, instead of using enumeration like 'Enumeration 1%' , we used enumeration='Enumeration 1' . but it doesn't help us. as by changing this we unable to get filtration result for other filter fields.

1

There are 1 best solutions below

3
On

Did you try using enumeration in ('Enumeration 1') ?