I finally found the bug that was causing CI to give me strange looking queries when using the active record class. Some time ago, the use_table() function was deprecated. The code to ‘not to break’ older apps is faulty.
What happens is that when a model or somewhere else in your app, uses this function, ci forgets to reset the var. so older , aldready set vars are being used to generate a new query. This gives strange results indeed !
the use_table() function puts it’s var into the ar_from() array and this does not get reset
Solution…... remove all code that uses these function… it cause your app to break.