Kind regards
Am 30.04.2009 um 17:08 schrieb lesquale <cedbourgeon@hotmail.com>:
>
> Someone helped me on another forum
>
> here is the source code i got for now :
>
> $max = $this->select()
> ->from($this, array(
> 'etudiant_id',
> 'periode_id',
> //'versionmax' => new Zend_Db_Expr('max(ce_version)')))
> 'versionmax' => 'max(ce_version)'))
> ->where('etudiant_id = "'.$etudiant.'"')
> ->group(array('etudiant_id', 'periode_id'));
>
> $select = $this->select()->setIntegrityCheck(false);
> $select->from(array('CE' => $this))
> ->join(
> //array('CEMAX'=> new Zend_Db_Expr($max)),
> array('CEMAX'=> $max),
> 'etudiant_id = CEMAX.etudiant_id',
> array()
> )
> ->where('CE.etudiant_id = 1 and CE.periode_id =
> CEMAX.periode_id AND
> CE.ce_version = CEMAX.versionmax')
> ->order('ce_version', 'DESC');
>
> $result = $this->fetchAll($select)->toArray();
>
>
>
> But now i got a server-side error message :
>
> Fatal error: Uncaught exception 'Zend_Db_Table_Select_Exception' with
> message 'Select query cannot join with another table'
>
> i read "$_dependantTables" and "$_referenceMap" variables have to be
> created
> - i did it
> and also "setIntegrityCheck(false)" method must be used with
> select() - i
> did it too
>
> with those changes, i got the following message :
>
> Catchable fatal error: Object of class Ce could not be converted to
> string
> in C:\www\si\library\Zend\Db\Adapter\Abstract.php on line 958
> --
> View this message in context: http://www.nabble.com/Try-to-create-a-%22join%22-query-tp23316634p23318273.html
> Sent from the Zend DB mailing list archive at Nabble.com.
>
没有评论:
发表评论