<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div>Hello everbody,<br><br></div>is it possible to use a resultset as subquery in the FROM clause and prefetch its results in a way, that it is available as an accessor in the final resultset?<br><br></div>In detail I would like to do a query like that:<br><br></div>select me.*, properties.me_id, properties.value<br>from table_me me join ( select id, property from complex_subselect where condition ) properties</div>on <a href="http://me.id">me.id</a> = <a href="http://properties.id">properties.id</a><br><br></div>... and the &quot;properties&quot; should be collapsed to the me-Table.<br><br></div>I would like to use DBIx::Class::ResultClass::HashRefInflator, but I think this is based on defining a &quot;prefetch&quot; and again this needs to find accessors in the underlying table_me resultset definition.<br><br></div><div>At the beginning working around this problem seemed kind of trivial to me, but now I&#39;m 
struggling. I thought, I could simply use a sub query in the 
from-attribute when searching the resultset and adding &quot;+columns&quot; and 
setting &quot;collapse&quot; to a true value. But this way, I am ending up with only a
 single property column.<br><br></div>What I want my final result hash to look like is...<br></div><div><br>[<br></div>    {<br></div><div>        <a href="http://me.id">me.id</a> =&gt; 1,<br></div>        me.hello =&gt; &quot;world&quot;,<br></div>        me.some =&gt; &quot;thing&quot;,<br></div><div>        # ... more fields<br><br></div>        properties =&gt; [<br></div>            { me_id =&gt; 1, value =&gt; &quot;something, that I don&#39;t get by simply joining tables&quot; },<br>            { me_id =&gt; 1, value =&gt; &quot;the next item in a really long lis&quot; },<br></div>            # ... more properties<br><div>        ]<br><div><div><div><div>    },<br>    {<br></div><div>        # .... next result object<br></div><div>    }<br><div><div>]<br><br></div><div>Is it possible to do that in a single database request (with DBIx::Class::ResultClass::HashRefInflator)?<br></div><div><br>Thanks in advance : )<br></div><div>Thilo<br></div></div></div></div></div></div></div></div>