Active Record: how do I combine two or_like with an AND between them? |
[eluser]m4rw3r[/eluser]
You mean that your SQL should look something like this? Code: WHERE (regions LIKE '%a%' OR regions LIKE '%b%') AND (instruments LIKE '%c%' OR instruments LIKE '%d%') But I have developed a SQL-builder which is capable to do this: IgnitedQuery. It is an improved version of CI's AR (a rewrite) which also is capable of handling subqueries and nested wheres (which you want in this case). I don't have much information available because I need to rewrite IgnitedRecord's manual (which includes IgnitedQuery's, because IgnitedRecord uses IgntedQuery to generate SQL). Your example would look like this with IQ: Code: // $query can be treated just like CI's AR |
Messages In This Thread |
Active Record: how do I combine two or_like with an AND between them? - by El Forum - 11-29-2008, 05:52 PM
Active Record: how do I combine two or_like with an AND between them? - by El Forum - 11-30-2008, 11:14 AM
Active Record: how do I combine two or_like with an AND between them? - by El Forum - 12-01-2008, 01:40 AM
Active Record: how do I combine two or_like with an AND between them? - by El Forum - 12-01-2008, 04:22 AM
|