CodeIgniter Forums
how to an extra AND condition in include_related() option in datamapper ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: how to an extra AND condition in include_related() option in datamapper ? (/showthread.php?tid=48852)



how to an extra AND condition in include_related() option in datamapper ? - El Forum - 01-30-2012

[eluser]Unknown[/eluser]
i have a little problem here ..
i want to filter the results from the include_related table itself not in the table the parent model calls ...
where_related filtered the whole set of result ... that didn't work for me ...

hoping for somebody with a easy and nice way out of this problem.
thanks.


how to an extra AND condition in include_related() option in datamapper ? - El Forum - 01-31-2012

[eluser]WanWizard[/eluser]
Start by explaining exactly what you want, this doesn't make much sense to me.

An include_related is a JOIN, so any WHERE clause you insert in the query always has an effect on the end result.


how to an extra AND condition in include_related() option in datamapper ? - El Forum - 05-29-2013

[eluser]Unknown[/eluser]
Hi,

I believe that I'm facing the same problem. The thing is i have to do this query:

SELECT *
FROM (`users`)
LEFT OUTER JOIN `pic_users` pic_users ON `users`.`id` = `pic_users`.`user_id` AND pic_users.status = TRUE

I need to add one more clause to my ON clause.

Anyone has ever faced something like that?

Thanks!