Be careful, LEAST is not SQL standard, this means if you change you
database server, you may (will) encounter problems.
Why not doing it with PHP ? You have the min function : http://fr.php.net/min


On 29 sep, 15:05, torok84 <toro...@gmail.com> wrote:
> Workaround:
>
> $conn = Doctrine::getConnectionByTableName('User');
> $conn->exec('UPDATE user SET points = LEAST(200,300)');
>
> Any chance this can be done using Doctrine?
>
> Paolo
>
> On Sep 29, 2:56 pm, torok84 <toro...@gmail.com> wrote:
>
> > [ In the real application I would have something like
> > LEAST(user.points, 300) ]
> > Hello, I do not understand very well how the set() function works
>
> > I tryed the following code:
>
> > $q = Doctrine_Query::create()
> >   ->update('User u')
> >   ->set('u.points', 'LEAST(200,100)');
> > echo $q->getSqlQuery();
>
> > But the generated SQL code is
> > UPDATE user SET points = LEAST(200)
>
> > I tryed some other things, but none of them worked. For example
> >   ->set('u.points', '?' , 'LEAST(200,100)');
> > will generate
> > UPDATE user SET points = 'LEAST(200,300)'
>
> >  How can I create the query I want?
>
> > Thanks
> > Paolo

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to