<?xml version="1.0"?>

<custom-sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.countByGroupId">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Group_
			[$JOIN$]
			WHERE
				[$WHERE$]
				(Group_.groupId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.countByC_N_D">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Group_
			[$JOIN$]
			WHERE
				[$WHERE$]
				(Group_.companyId = ?) AND
				(Group_.className IS NULL OR Group_.className = '') AND
				(Group_.classPK IS NULL OR Group_.classPK = '') AND
				(lower(Group_.name) LIKE ? OR ? IS NULL) AND
				(lower(Group_.description) LIKE ? OR ? IS NULL)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.findByC_N">
		<![CDATA[
			SELECT
				{Group_.*}
			FROM
				Group_
			WHERE
				(Group_.companyId = ?) AND
				(lower(Group_.name) = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.findByC_N_D">
		<![CDATA[
			SELECT
				Group_.groupId AS groupId, Group_.name AS groupName
			FROM
				Group_
			[$JOIN$]
			WHERE
				[$WHERE$]
				(Group_.companyId = ?) AND
				(Group_.className IS NULL OR Group_.className = '') AND
				(Group_.classPK IS NULL OR Group_.classPK = '') AND
				(lower(Group_.name) LIKE ? OR ? IS NULL) AND
				(lower(Group_.description) LIKE ? OR ? IS NULL)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.joinByGroupsOrgs">
		<![CDATA[
			INNER JOIN
				Groups_Orgs ON
					(Groups_Orgs.groupId = Group_.groupId)
			INNER JOIN
				Users_Orgs ON
					(Users_Orgs.organizationId = Groups_Orgs.organizationId)
			WHERE
				(Users_Orgs.userId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.joinByGroupsRoles">
		<![CDATA[
			INNER JOIN
				Groups_Roles ON
					(Groups_Roles.groupId = Group_.groupId)
			WHERE
				(Groups_Roles.roleId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.joinByGroupsUserGroups">
		<![CDATA[
			INNER JOIN
				Groups_UserGroups ON
					(Groups_UserGroups.groupId = Group_.groupId)
			INNER JOIN
				Users_UserGroups ON
					(Users_UserGroups.userGroupId = Groups_UserGroups.userGroupId)
			WHERE
				(Users_UserGroups.userId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.joinByLayoutSet">
		<![CDATA[
			INNER JOIN
				LayoutSet ON
					(LayoutSet.groupId = Group_.groupId)
			WHERE
				(LayoutSet.privateLayout = ?) AND
				(LayoutSet.pageCount != 0)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.joinByRolePermissions">
		<![CDATA[
			INNER JOIN
				Resource_ ON
					(Resource_.primKey = Group_.groupId)
			INNER JOIN
				Permission_ ON
					(Permission_.resourceId = Resource_.resourceId)
			INNER JOIN
				Roles_Permissions ON
					(Roles_Permissions.permissionId = Permission_.permissionId)
			WHERE
				(Resource_.name = ?) AND
				(Resource_.typeId = ?) AND
				(Resource_.scope = ?) AND
				(Permission_.actionId = ?) AND
				(Roles_Permissions.roleId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.GroupFinder.joinByUsersGroups">
		<![CDATA[
			INNER JOIN
				Users_Groups ON
					(Users_Groups.userId = ?)
			WHERE
				(Users_Groups.groupId = Group_.groupId)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.ImageFinder.findByImageId">
		<![CDATA[
			SELECT
				{Image.*}
			FROM
				Image
			WHERE
				imageId LIKE ?
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.LayoutFinder.findByC_P_P">
		<![CDATA[
			SELECT
				DISTINCT Layout.layoutId AS layoutLayoutId, Layout.ownerId AS layoutOwnerId, PortletPreferences.portletId AS prefsPortletId
			FROM
				Layout
			INNER JOIN
				PortletPreferences ON
					(PortletPreferences.layoutId = Layout.layoutId) AND
					(PortletPreferences.ownerId = Layout.ownerId)
			WHERE
				(Layout.companyId = ?) AND
				(
					(PortletPreferences.portletId = ?) OR
					(PortletPreferences.portletId LIKE ?)
				) AND
				(PortletPreferences.preferences LIKE ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.LayoutSetFinder.findByC_V">
		<![CDATA[
			SELECT
				{LayoutSet.*}
			FROM
				LayoutSet
			WHERE
				(LayoutSet.companyId = ?) AND
				(lower(LayoutSet.virtualHost) = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.OrganizationFinder.countByC_PO_N_S_C_Z_R_C">
		<![CDATA[
			SELECT
				COUNT(DISTINCT Organization_.organizationId) AS COUNT_VALUE
			FROM
				Organization_
			LEFT JOIN
				Address ON
					(Address.className = 'com.liferay.portal.model.Organization') AND
					(Address.classPK = Organization_.organizationId)
			[$JOIN$]
			WHERE
				[$WHERE$]
				(Organization_.companyId = ?) AND
				(Organization_.parentOrganizationId [$PARENT_ORGANIZATION_ID_COMPARATOR$] ?) AND
				(
					(lower(Organization_.name) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(
						(lower(Address.street1) LIKE ? [$AND_OR_NULL_CHECK$]) OR
						(lower(Address.street2) LIKE ? [$AND_OR_NULL_CHECK$]) OR
						(lower(Address.street3) LIKE ? [$AND_OR_NULL_CHECK$])
					) [$AND_OR_CONNECTOR$]
					(lower(Address.city) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(Address.zip) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(
						(Organization_.regionId = ? [$AND_OR_NULL_CHECK$]) OR
						(Address.regionId = ? [$AND_OR_NULL_CHECK$])
					) [$AND_OR_CONNECTOR$]
					(
						(Organization_.countryId = ? [$AND_OR_NULL_CHECK$]) OR
						(Address.countryId = ? [$AND_OR_NULL_CHECK$])
					)
				)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.OrganizationFinder.findByC_PO_N_S_C_Z_R_C">
		<![CDATA[
			SELECT
				DISTINCT Organization_.organizationId AS orgId, Organization_.name AS orgName
			FROM
				Organization_
			LEFT JOIN
				Address ON
					(Address.className = 'com.liferay.portal.model.Organization') AND
					(Address.classPK = Organization_.organizationId)
			[$JOIN$]
			WHERE
				[$WHERE$]
				(Organization_.companyId = ?) AND
				(Organization_.parentOrganizationId [$PARENT_ORGANIZATION_ID_COMPARATOR$] ?) AND
				(
					(lower(Organization_.name) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(
						(lower(Address.street1) LIKE ? [$AND_OR_NULL_CHECK$]) OR
						(lower(Address.street2) LIKE ? [$AND_OR_NULL_CHECK$]) OR
						(lower(Address.street3) LIKE ? [$AND_OR_NULL_CHECK$])
					) [$AND_OR_CONNECTOR$]
					(lower(Address.city) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(Address.zip) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(
						(Organization_.regionId = ? [$AND_OR_NULL_CHECK$]) OR
						(Address.regionId = ? [$AND_OR_NULL_CHECK$])
					) [$AND_OR_CONNECTOR$]
					(
						(Organization_.countryId = ? [$AND_OR_NULL_CHECK$]) OR
						(Address.countryId = ? [$AND_OR_NULL_CHECK$])
					)
				)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.OrganizationFinder.joinByGroupsPermissions">
			INNER JOIN
				Group_ ON
					(Group_.classPK = Organization_.organizationId)
			INNER JOIN
				Groups_Permissions ON
					(Groups_Permissions.groupId = Group_.groupId)
			INNER JOIN
				Permission_ ON
					(Permission_.permissionId = Groups_Permissions.permissionId)
			WHERE
				(Group_.className = 'com.liferay.portal.model.Organization') AND
				(Permission_.resourceId = ?)
	</sql>
	<sql id="com.liferay.portal.service.persistence.OrganizationFinder.joinByOrganizationsGroups">
		<![CDATA[
			INNER JOIN
				Groups_Orgs ON
					(Groups_Orgs.organizationId = Organization_.organizationId)
			WHERE
				(Groups_Orgs.groupId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.OrganizationFinder.joinByOrganizationsRoles">
		<![CDATA[
			INNER JOIN
				Group_ ON
					(Group_.classPK = Organization_.organizationId)
			INNER JOIN
				Groups_Roles ON
					(Groups_Roles.groupId = Group_.groupId)
			WHERE
				(Group_.className = 'com.liferay.portal.model.Organization') AND
				(Groups_Roles.roleId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.OrganizationFinder.joinByOrgGroupPermission">
			INNER JOIN
				OrgGroupPermission ON
					(OrgGroupPermission.organizationId = Organization_.organizationId)
			INNER JOIN
				Permission_ ON
					(Permission_.permissionId = OrgGroupPermission.permissionId)
			WHERE
				(Permission_.resourceId = ?) AND
				(OrgGroupPermission.groupId = ?)

	</sql>
	<sql id="com.liferay.portal.service.persistence.OrgGroupPermissionFinder.findByO_G_R">
		<![CDATA[
			SELECT
				{OrgGroupPermission.*}
			FROM
				OrgGroupPermission
			INNER JOIN
				Permission_ ON
					(Permission_.permissionId = OrgGroupPermission.permissionId)
			WHERE
				(Permission_.resourceId = ?) AND
				(OrgGroupPermission.organizationId = ?) AND
				(OrgGroupPermission.groupId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.countByGroupsPermissions">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Permission_
					INNER JOIN
						Groups_Permissions ON
							(Groups_Permissions.permissionId = Permission_.permissionId)
			WHERE
				([$PERMISSION_IDS$]) AND
				([$GROUP_IDS$])
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.countByGroupsRoles">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Groups_Roles
					INNER JOIN
						Roles_Permissions ON
							(Roles_Permissions.roleId = Groups_Roles.roleId)
					INNER JOIN
						Permission_ ON
							(Permission_.permissionId = Roles_Permissions.permissionId)
			WHERE
				([$PERMISSION_IDS$]) AND
				([$GROUP_IDS$])
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.countByRolesPermissions">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Permission_
					INNER JOIN
						Roles_Permissions ON
							(Roles_Permissions.permissionId = Permission_.permissionId)
			WHERE
				([$PERMISSION_IDS$]) AND
				([$ROLE_IDS$])
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.countByUsersPermissions">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Permission_
					INNER JOIN
						Users_Permissions ON
							(Users_Permissions.permissionId = Permission_.permissionId)
			WHERE
				([$PERMISSION_IDS$]) AND
				(Users_Permissions.userId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.countByUsersRoles">
		<![CDATA[
			SELECT
				COUNT(*) AS COUNT_VALUE
			FROM
				Users_Roles
					INNER JOIN
						Roles_Permissions ON
							(Roles_Permissions.roleId = Users_Roles.roleId)
					INNER JOIN
						Permission_ ON
							(Permission_.permissionId = Roles_Permissions.permissionId)
			WHERE
				([$PERMISSION_IDS$]) AND
				(Users_Roles.userId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.findByA_R">
		<![CDATA[
			SELECT
				{Permission_.*}
			FROM
				Permission_
			WHERE
				(actionId = ?) AND
				([$RESOURCE_IDS$])
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.findByG_R">
		<![CDATA[
			SELECT
				{Permission_.*}
			FROM
				Permission_
			INNER JOIN
				Groups_Permissions ON
					(Groups_Permissions.permissionId = Permission_.permissionId)
			WHERE
				(Groups_Permissions.groupId = ?) AND
				(Permission_.resourceId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.findByU_R">
		<![CDATA[
			SELECT
				{Permission_.*}
			FROM
				Permission_
			INNER JOIN
				Users_Permissions ON
					(Users_Permissions.permissionId = Permission_.permissionId)
			WHERE
				(Users_Permissions.userId = ?) AND
				(Permission_.resourceId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.findByO_G_R">
		<![CDATA[
			SELECT
				{Permission_.*}
			FROM
				Permission_
			INNER JOIN
				OrgGroupPermission ON
					(OrgGroupPermission.permissionId = Permission_.permissionId)
			WHERE
				(OrgGroupPermission.organizationId = ?) AND
				(OrgGroupPermission.groupId = ?) AND
				(Permission_.resourceId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PermissionFinder.findByU_A_R">
		<![CDATA[
			SELECT
				{Permission_.*}
			FROM
				Permission_
			INNER JOIN
				Users_Permissions ON
					(Users_Permissions.permissionId = Permission_.permissionId)
			WHERE
				(Users_Permissions.userId = ?) AND
				([$ACTION_IDS$]) AND
				(Permission_.resourceId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.PortletPreferencesFinder.findByPortletId">
		<![CDATA[
			SELECT
				{PortletPreferences.*}
			FROM
				PortletPreferences
			WHERE
				portletId LIKE ?
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.ResourceFinder.findByC_P">
		<![CDATA[
			SELECT
				{Resource_.*}
			FROM
				Resource_
			WHERE
				(Resource_.companyId = ?) AND
				(Resource_.primKey LIKE ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.RoleFinder.countByC_N_D">
		<![CDATA[
			SELECT
				COUNT(DISTINCT roleId) AS COUNT_VALUE
			FROM
				Role_
			WHERE
				(Role_.companyId = ?) AND
				(Role_.className IS NULL OR Role_.className = '') AND
				(Role_.classPK IS NULL OR Role_.classPK = '') AND
				(lower(Role_.name) LIKE ? OR ? IS NULL) AND
				(lower(Role_.description) LIKE ? OR ? IS NULL)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.RoleFinder.findByC_N">
		<![CDATA[
			SELECT
				{Role_.*}
			FROM
				Role_
			WHERE
				(Role_.companyId = ?) AND
				(lower(Role_.name) = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.RoleFinder.findByU_G">
		<![CDATA[
			(
				SELECT
					{Role_.*}
				FROM
					Role_
				INNER JOIN
					Users_Roles ON
						(Users_Roles.roleId = Role_.roleId)
				WHERE
					(Users_Roles.userId = ?)
			)
			UNION
			(
				SELECT
					{Role_.*}
				FROM
					Role_
				INNER JOIN
					Groups_Roles ON
						(Groups_Roles.roleId = Role_.roleId)
				WHERE
					([$GROUP_IDS$])
			)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.RoleFinder.findByC_N_D">
		<![CDATA[
			SELECT
				{Role_.*}
			FROM
				Role_
			WHERE
				(Role_.companyId = ?) AND
				(Role_.className IS NULL OR Role_.className = '') AND
				(Role_.classPK IS NULL OR Role_.classPK = '') AND
				(lower(Role_.name) LIKE ? OR ? IS NULL) AND
				(lower(Role_.description) LIKE ? OR ? IS NULL)
			ORDER BY
				Role_.name ASC
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.countByC_FN_MN_LN_EA_A">
		<![CDATA[
			SELECT
				COUNT(DISTINCT User_.userId) AS COUNT_VALUE
			FROM
				User_
			INNER JOIN
				Contact_ ON
					(Contact_.contactId = User_.userId)
			[$JOIN$]
			WHERE
				[$WHERE$]
				(User_.companyId = ?) AND
				(
					(lower(Contact_.firstName) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(Contact_.middleName) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(Contact_.lastName) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(User_.emailAddress) LIKE ? [$AND_OR_NULL_CHECK$])
				) AND
				(User_.active_ = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.findByC_FN_MN_LN_EA_A">
		<![CDATA[
			SELECT
				DISTINCT {User_.*}, Contact_.firstName, Contact_.middleName, Contact_.lastName
			FROM
				User_
			INNER JOIN
				Contact_ ON
					(Contact_.contactId = User_.userId)
			[$JOIN$]
			WHERE
				[$WHERE$]
				(User_.companyId = ?) AND
				(
					(lower(Contact_.firstName) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(Contact_.middleName) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(Contact_.lastName) LIKE ? [$AND_OR_NULL_CHECK$]) [$AND_OR_CONNECTOR$]
					(lower(User_.emailAddress) LIKE ? [$AND_OR_NULL_CHECK$])
				) AND
				(User_.active_ = ?)
			ORDER BY
				Contact_.firstName ASC,
				Contact_.middleName ASC,
				Contact_.lastName ASC
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.joinByUsersGroups">
		<![CDATA[
			INNER JOIN
				Users_Groups ON
					(Users_Groups.userId = User_.userId)
			WHERE
				(Users_Groups.groupId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.joinByUsersOrgs">
			INNER JOIN
				Users_Orgs ON
					(Users_Orgs.userId = User_.userId)
			WHERE
				(Users_Orgs.organizationId = ?)
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.joinByPermission">
		<![CDATA[
			INNER JOIN
				Users_Permissions ON
					(Users_Permissions.userId = User_.userId)
			INNER JOIN
				Permission_ ON
					(Permission_.permissionId = Users_Permissions.permissionId)
			WHERE
				(Permission_.resourceId = ?)		
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.joinByUsersRoles">
		<![CDATA[
			INNER JOIN
				Users_Roles ON
					(Users_Roles.userId = User_.userId)
			WHERE
				(Users_Roles.roleId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserFinder.joinByUsersUserGroups">
		<![CDATA[
			INNER JOIN
				Users_UserGroups ON
					(Users_UserGroups.userId = User_.userId)
			WHERE
				(Users_UserGroups.userGroupId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserGroupFinder.countByC_N_D">
		<![CDATA[
			SELECT
				COUNT(DISTINCT UserGroup.userGroupId) AS COUNT_VALUE
			FROM
				UserGroup
			[$JOIN$]
			WHERE
				[$WHERE$]
				(UserGroup.companyId = ?) AND
				(lower(UserGroup.name) LIKE ? OR ? IS NULL) AND
				(lower(UserGroup.description) LIKE ? OR ? IS NULL)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserGroupFinder.findByC_N">
		<![CDATA[
			SELECT
				{UserGroup.*}
			FROM
				UserGroup
			WHERE
				(UserGroup.companyId = ?) AND
				(lower(UserGroup.name) = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserGroupFinder.findByC_N_D">
		<![CDATA[
			SELECT
				DISTINCT {UserGroup.*}
			FROM
				UserGroup
			[$JOIN$]
			WHERE
				[$WHERE$]
				(UserGroup.companyId = ?) AND
				(lower(UserGroup.name) LIKE ? OR ? IS NULL) AND
				(lower(UserGroup.description) LIKE ? OR ? IS NULL)
			ORDER BY
				UserGroup.name ASC
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserGroupFinder.joinByGroupsPermissions">
			INNER JOIN
				Group_ ON
					(Group_.classPK = UserGroup.userGroupId)
			INNER JOIN
				Groups_Permissions ON
					(Groups_Permissions.groupId = Group_.groupId)
			INNER JOIN
				Permission_ ON
					(Permission_.permissionId = Groups_Permissions.permissionId)
			WHERE
				(Group_.className = 'com.liferay.portal.model.UserGroup') AND
				(Permission_.resourceId = ?)
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserGroupFinder.joinByUserGroupsGroups">
		<![CDATA[
			INNER JOIN
				Groups_UserGroups ON
					(Groups_UserGroups.userGroupId = UserGroup.userGroupId)
			WHERE
				(Groups_UserGroups.groupId = ?)
		]]>
	</sql>
	<sql id="com.liferay.portal.service.persistence.UserGroupFinder.joinByUserGroupsRoles">
		<![CDATA[
			INNER JOIN
				Group_ ON
					(Group_.classPK = UserGroup.userGroupId)
			INNER JOIN
				Groups_Roles ON
					(Groups_Roles.groupId = Group_.groupId)
			WHERE
				(Group_.className = 'com.liferay.portal.model.UserGroup') AND
				(Groups_Roles.roleId = ?)
		]]>
	</sql>
</custom-sql>