Welcome Guest, Not a member yet? Register   Sign In
Select AND / OR problem
#4

[eluser]xwero[/eluser]
It's not fully in the AR idea of creating database independent queries but you can add a string as a where part of the sql statement. In your case it would be something like
Code:
$query = $this->db->select('productID')->from('product')->where('(`productName` LIKE ‘clear %’ OR `productName` LIKE ‘% clear %’ OR `productName` LIKE ‘% clear’) AND (`productName` LIKE ‘file %’ OR `productName` LIKE ‘% file %’ OR `productName` LIKE ‘% file’)')->get();

I like to use the from method to be as close as possible to the actual sql statement but you can add the table as the first argument of the get method to save you some typing.


Messages In This Thread
Select AND / OR problem - by El Forum - 06-09-2008, 12:29 AM
Select AND / OR problem - by El Forum - 06-09-2008, 12:43 AM
Select AND / OR problem - by El Forum - 06-09-2008, 01:24 AM
Select AND / OR problem - by El Forum - 06-09-2008, 01:41 AM
Select AND / OR problem - by El Forum - 06-11-2008, 01:34 AM
Select AND / OR problem - by El Forum - 08-29-2008, 12:08 AM
Select AND / OR problem - by El Forum - 08-29-2008, 01:01 AM
Select AND / OR problem - by El Forum - 08-29-2008, 01:33 AM
Select AND / OR problem - by El Forum - 08-29-2008, 01:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB