2009年4月15日星期三

RE: [fw-db] Select a rowset with a join for order

Thanks, that was the solution

 

Regards,

Tobias van Beek

 

From: Hector Virgen [mailto:djvirgen@gmail.com]
Sent: dinsdag 14 april 2009 18:43
To: Tobias van Beek
Cc: fw-db@lists.zend.com
Subject: Re: [fw-db] Select a rowset with a join for order

 

Pass an empty array as the third parameter to join(). The third parameter is an array of columns to fetch from the join table, which defaults to '*'

 

$select->join('dbi.groepskolom','dbi.groepskolom.kolomnaam=dbi.kolommen.naam,dbi.groepskolom.tabel_naam=dbi.kolommen.tabel_naam', array());


-Hector

On Tue, Apr 14, 2009 at 9:10 AM, Tobias van Beek <tobiasvanbeek@gmail.com> wrote:

Hello,

 

I want to select a rowset from a table and I want to order the set with a column from another table. I don’t need the information from the other table.

Is this possible?

With the code I have I only get an array

 

    $tabel = new Model_Kolom();

    $select = $tabel->select();

    $select->setIntegrityCheck(false)

          ->join('dbi.groepskolom','dbi.groepskolom.kolomnaam=dbi.kolommen.naam,dbi.groepskolom.tabel_naam=dbi.kolommen.tabel_naam')

          ->where('dbi.groepskolom.groepsnaam=?',$this->naam)

          ->order('groepskolom.positie');

    $this->kolommenArray = $tabel->fetchAll($select)->toArray();

 

Model_Kolom only set the table name, the database schema and the rowclass

My database is Postgresql

 

Regards,

Tobias van Beek

 

没有评论: