2010年4月16日星期五

[fw-db] aggregete joins failing, looking for a workaround

Hope I can describe the issue well.

in my zend_db_select object I have a join condition build around an
aggregating subquery vs a table object.

the join in question:

->join(array('licenses' =>'(SELECT a.paid_until_date, a.linkto_instances_id,
a.serialnumber FROM licenses as a JOIN (SELECT linkto_instances_id,
max(paid_until_date) AS paid_until_date, serialnumber FROM licenses GROUP BY
linkto_instances_id) AS pm ON a.linkto_instances_id = pm.linkto_instances_id
AND a.paid_until_date = pm.paid_until_date)'), 'licenses.linkto_instances_id
= instances.id', array('licenseserialnumber' => 'serialnumber'))

everything is going well until the join gets passed in to the _join method
in Zend\DB\Select.php, line 797 when the logic hits this conditional while
$tableName contains the long aggregete select:

if (!is_object($tableName) && false !== strpos($tableName, '.')) {

which in turn launches the process that takes my SELECT aggregate (not an
object that has a period in the string) and strips it down to "select a."

suggestions on how to work around this?

Thanks in advance

Mike

--
View this message in context: http://n4.nabble.com/aggregete-joins-failing-looking-for-a-workaround-tp2013446p2013446.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: