Typo3 8.7.x Flexform:从选定的记录存储页面获取所有sys_categories

I'm trying to get all sys_categories from the selected record storage pages, but I get only the sys_categories from the first entry at the record storage list.

<settings.categories>
    <TCEforms>
        <displayCond>FIELD:parentRec.pages:REQ:true</displayCond>
        <label>Categories</label>
        <config>
            <type>select</type>
            <renderType>selectTree</renderType>
            <autoSizeMax>15</autoSizeMax>
            <foreign_table>sys_category</foreign_table>
            <foreign_table_where> AND sys_category.sys_language_uid IN (-1, 0) AND sys_category.pid IN (SELECT pages FROM tt_content WHERE uid=###THIS_UID###) ORDER BY sys_category.sorting ASC</foreign_table_where>
            <maxitems>9999</maxitems>
            <size>10</size>
            <treeConfig>
                <appearance>
                    <expandAll>1</expandAll>
                    <showHeader>1</showHeader>
                </appearance>
                <parentField>parent</parentField>
            </treeConfig>
        </config>
    </TCEforms>
</settings.categories>

It's working, if I write the ID static:

...AND sys_category.pid IN (430,459)...

I found out that the subqueries result looks like this

...AND sys_category.pid IN ('430,459')...

but I need it like the static example. It's also not working, if I try the following

...AND sys_category.pid IN (###REC_FIELD_pages###)...