I don't think it's possible to get that to work the way you want.
The way that the prepare/execute combo works is that the prepare parses the query and figures out the most efficient way to run it, then execute just plugs in a few constants to define the details. A subquery, however, isn't a constant, it's something else which has to be parsed and planned along with the main query, so I really, really doubt that it's possible to use one as a parameter.
Probably the best you're going to be able to do is move the prepare into the loop, change it to prepare_cached, and put the actual subquery into the statement you're preparing. You're going to have to do separate preparation for each subquery, but prepare_cached should at least prevent you from repeating your work when/if multiple rows have identical subqueries.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||