I am trying to perform a right outer join on two liferay tables — users_
and expandovalue
— to get a result set.
When I did the following query on all the users, I got desired result.
SELECT USER_.FIRSTNAME
, USER_.LASTNAME
, USER_.EMAILADDRESS
, USER_.JOBTITLE
, expandovalue.data_
from expandovalue
right outer join
user_ on expandovalue.classpk = user_.userid
and expandovalue.columnid =35695;
When tried to do the same for a set of users (part of a user group) it errored out. Query below:
SELECT USER_.FIRSTNAME
, USER_.LASTNAME
, USER_.EMAILADDRESS
, USER_.JOBTITLE
, expandovalue.data_
from expandovalue
right outer join
user_ on expandovalue.classpk
in (select userid
from user_
where userid
in ( select userid
from users_usergroups
where usergroupid = 40073
) and status =0) = user_.userid in
(select userid
from user_
where userid
in ( select userid
from users_usergroups
where usergroupid = 40073
)
and status =0
) and expandovalue.columnid =35695
Here's the subquery which gives the userid
s of people in a particular usergroup.
(select userid
from user_
where userid in
( select userid
from users_usergroups
where usergroupid = 40073)
and status =0
)
Am I going in a completely incorrect direction? Please advise.