The problem is this line:

$c->addDescendingOrderByColumn('CREATED_AT');

You should use the Peer constant for the column you wish to sort by,
and for this example I'd guess that you want:

$c->addDescendingOrderByColumn(QuestionPeer::CREATED_AT);

jbw

On 5/30/07, laurent langlais <[EMAIL PROTECTED]> wrote:
>
> hi everyone,
> i've got an error message when trying to use doSelectJoinAll in a
> normal action class : "ambiguous column name"
> This error seems to be the same as ticket #845 which dealed with admin
> generator and was closed and fixed for release 1.0.
>
> is it really a symfony bug or did i make an error ?
> thanks a lot !
>
>
> here is my error message :
>  [wrapped: Could not execute query [Native Error: sqlite_query()
> [function.sqlite-query]: ambiguous column name: CREATED_AT] [User
> Info: SELECT question.ID, question.TITLE, question.CONTENT,
> question.STATUS_ID, question.CATEGORY_ID, question.AUTHOR_ID,
> question.CREATED_AT, status.ID, status.NAME, status.CSS, status.RANK,
> status.CREATED_AT, category.ID, category.NAME, category.CREATED_AT,
> author.ID, author.NAME, author.EMAIL, author.SUBSIDIARY_ID,
> author.CREATED_AT FROM question, status, category, author WHERE
> question.STATUS_ID=status.ID AND question.CATEGORY_ID=category.ID AND
> question.AUTHOR_ID=author.ID ORDER BY CREATED_AT DESC]]
>
> here is my code :
>
>   public function executeList()
>   {
>         $c=new Criteria();
> $this->category='';
> $this->author='';
> $this->subsidiary='';
>         if($this->getRequestParameter('category_id'))
>         {
>             $c->add(QuestionPeer::CATEGORY_ID,
> $this->getRequestParameter('category_id'));
>
>                 
> $this->category=CategoryPeer::retrieveByPk($this->getRequestParameter('category_id'));
>         }
>         if($this->getRequestParameter('author_id'))
>         {
>             $c->add(QuestionPeer::AUTHOR_ID, 
> $this->getRequestParameter('author_id'));
>                 
> $this->author=AuthorPeer::retrieveByPk($this->getRequestParameter('author_id'));
>         }
>         if($this->getRequestParameter('subsidiary_id'))
>         {
>                 $c->addJoin( QuestionPeer::AUTHOR_ID, AuthorPeer::ID );
>                 $c->add( AuthorPeer::SUBSIDIARY_ID,
> $this->getRequestParameter('subsidiary_id') );
>                 
> $this->subsidiary=SubsidiaryPeer::retrieveByPk($this->getRequestParameter('subsidiary_id'));
>         }
>
>         $c->addDescendingOrderByColumn('CREATED_AT');
>
>
>         $this->questions = QuestionPeer::doSelectJoinAll($c);
>
>
>   }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to