Hello Admin
I have 2 questions
1. How does Cook ORM handle select distinct from table?
2. I have "groups" and "usergroups" tables as part of my component which I link to within a query. I also link to the native Joomla tables in that same query but Cook ORM seems not to understand that these two sets of tables are really very different. I am not sure how to ask it to make the aliases unique without changing my table names.
Thanks
vlemos
The final query should look like this:
SELECT DISTINCT
a.id,
a.user_id,
_user_id_.name AS `_user_id_name`,
_user_usergroup_map_id_.group_id AS `_user_usergroup_map_id_group_id`,
_usergroup_id_.title AS `_usergroup_id_title`,
a.created_by,
a.published
FROM #__cook_users AS a
LEFT JOIN `#__users` AS _user_id_
ON _user_id_.id = a.user_id
LEFT JOIN `#__user_usergroup_map` AS _user_usergroup_map_id_
ON _user_usergroup_map_id_.user_id = a.user_id
LEFT JOIN `#__usergroups` AS _usergroup_id_
ON _usergroup_id_.id = _user_usergroup_map_id_.group_id
LEFT JOIN `#__cook_usergroups` AS _usergroups_id_
ON _usergroups_id_.user_id = a.id
LEFT JOIN `#__cook_groups` AS _group_id_
ON _group_id_.id = _usergroups_id_.group_id
WHERE ( a.published = 0
OR a.published = 1
OR a.published IS NULL )
AND _usergroup_id_.title = 'Mrs.'
AND _group_id_.level >= 30
AND a.company_id = 1
ORDER BY a.user_id ASC