我正在尝试在两个 liferay 表上执行右外连接 -users_
并且expandovalue
- 以获得结果集。
当我对所有用户进行以下查询时,我得到了想要的结果。
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;
当尝试对一组用户(用户组的一部分)执行相同操作时,它会出错。如下查询:
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
这是给出userid
特定用户组中人员 s 的子查询。
(select userid
from user_
where userid in
( select userid
from users_usergroups
where usergroupid = 40073)
and status =0
)
我会朝着一个完全错误的方向前进吗?请指教。