Rick Morrison wrote:
>> On 10/16/07, *Jim Musil* <[EMAIL PROTECTED]> wrote: 
>>     Hi,
>> 
>>     I'm trying to determine  a way to append  a LIMIT to an update()
>>     object.
>> 
>>     Is the solution a correlated update on the same table with the LIMIT
>>     on the select() object?
 >
> Yes, that would be the only thing that has a hope of working across 
> database engines. LIMIT with UPDATE is MySQL-only AFAIK.
> 
> For SA, joins in updates can be tricky, so the correlated query would 
> best be a IN() or EXISTS() query that has the limit you want. To get a 
> deterministic set of records that will be updated, you'll probably need 
> an ORDER BY on that subquery too.

I've added UPDATE with LIMIT support on MySQL to the trunk for the 
forthcoming 0.4.0 release.  MySQL doesn't allow an update to select from 
the table being updated, so the generic solution via correlated update 
is out on MySQL.

-j

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to