2009年5月1日星期五

Re: [fw-db] Try to create a "join" query

Dennis Winter wrote:
>
> Ok, I have to correct myself.
>
> Try: $this->getAdapter()->select()->from();
>
> Hope, that's it!
>
> Regards dennis
>
>
>

Thank you for your time

in fact, your suggestion is a port of the full solution
i made a mistake within the arguments i used for the join() method

here is the final and well-working source code - in case someone else could
need it :

$max = $this->getAdapter()->select()
->from($this->_name,
array('etudiant_id',
'periode_id',
'versionmax' => 'max(ce_version)'))
->group(array('etudiant_id', 'periode_id'));

$select = $this->select()
->from($this)
->join(array('CEMAX' => $max),
'CE.etudiant_id = CEMAX.etudiant_id and CE.periode_id =
CEMAX.periode_id AND CE.ce_version = CEMAX.versionmax',
array())
->where('CE.etudiant_id = ?', $etudiant)
->order('ce_version', 'DESC');

--
View this message in context: http://www.nabble.com/Try-to-create-a-%22join%22-query-tp23316634p23332270.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: