[eluser]Aea[/eluser]
Write that part of your clause manually, I ran into a similar issue with UCASE where the built in active record class was adding in 's in unnecessary places, so I wrote my entire query by hand, just don't forget to escape the data if you don't trust it
Unfortunately, something like Active Record as it's implemented in CI is only good for simpler queries, if what you're trying to do doesn't match the way AR does it, it seems you just have to write that part yourself.