Thank you Dheeraj. That worked realy well. Regards, Radu.
On Feb 28, 6:18 am, Dheeraj Kumar Aggarwal <[email protected]> wrote: > Hi radu, > > replace this line > $c->addAlias("T3_2", UsersPeer::TABLE_NAME); > > with > $c->addAlias("U2", UsersPeer::TABLE_NAME); > > and > replace this line > $c->addJoin(ArticlePeer::CREATEDBY_ID, UsersPeer::alias("U2", > UsersPeer::ID)); > > with > $c->addJoin(ArticlePeer::MODIFIEDBY_ID, UsersPeer::alias("U2", > UsersPeer::ID)); > > On Sat, Feb 28, 2009 at 9:44 AM, Dheeraj Kumar Aggarwal < > > [email protected]> wrote: > > hi radu, > > > i think this should work for you......... > > > $c = new Criteria(); > > > // Create Aliasses > > $c->addAlias("U1", UsersPeer::TABLE_NAME); > > $c->addAlias("T3_2", UsersPeer::TABLE_NAME); > > > // Create Joins > > $c->addJoin(ArticlePeer::CREATEDBY_ID, UsersPeer::alias("U1", > > UsersPeer::ID)); > > $c->addJoin(ArticlePeer::CREATEDBY_ID, UsersPeer::alias("U1", > > > > > > > UsersPeer::ID)); > > > $this->articleList = ArticlePeer::doSelect($c); > > > On Fri, Feb 27, 2009 at 7:07 PM, korfos <[email protected]> wrote: > > > > Hello all, > > > I'm new to symfony, so be gentle :) > > > > I have to tables: > > > users {id, name} > > > article{id, createdby_id, modifiedby_id} > > > createdby_id and modifiedby_id are foreign keys to users table > > > > When i do: > > > > $c = new Criteria(); > > > $c->addJoin(ArticlePeer::CREATEDBY_ID, UsersPeer::ID); > > > $c->addJoin(ArticlePeer::MODIFIEDBY_ID, UsersPeer::ID); > > > $this->articleList = ArticlePeer::doSelect($c); > > > > the resulting sql is: > > > > SELECT article.ID, article. CREATEDBY_ID, article. MODIFIEDBY_ID FROM > > > article, users WHERE article. CREATEDBY_ID=users.ID AND article. > > > MODIFIEDBY_ID=users.ID > > > > my question is: is there a way to make the sql look like this? > > > > SELECT article.ID, article. CREATEDBY_ID, article. MODIFIEDBY_ID FROM > > > article, users u1, users u2 WHERE article. CREATEDBY_ID=u1.ID AND > > > article. MODIFIEDBY_ID=u2.ID > > > > Thank you, > > > Radu. > > > -- > > Regards, > > Dheeraj > > -- > Regards, > Dheeraj --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
