2009年3月19日星期四

Re: [fw-db] Feature request: Zend_Db_Select UNION

I am attempting to use the method in Example 2 with ZendFramework v.1.7.6

I am getting the following error: Invalid use of table with UNION
MySQL version: 5.0.6

class Chemdb extends Zend_Db_Table
{
protected $_name = 'chemdb';
protected $_dependentTables = array('users','cmgdb');

/*
*Build Chemical List for Search
*/
public function buildlist($order) {
$select1 = parent::select();
$select1->from($this->_name, array(
'title',
'cas',
'synonyms'
));

$select2 = parent::select();
$select2->from('cmgdb', array(
'title',
'materialid AS cas',
'synonyms'
));


$select3 = parent::select();
$select3->union(array($select1,$select2));

//$sql = '(SELECT title,cas,synonyms FROM chemdb) UNION (SELECT
title,materialid AS cas,synonyms FROM cmgdb) ORDER BY title';

$results = parent::fetchall($select3);

return $results;
}
}

Is this method still in the trunk or should this be working?

Thanks - LK
--
View this message in context: http://www.nabble.com/Feature-request%3A-Zend_Db_Select-UNION-tp16511719p22611974.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: