Tim Chase wrote:
> Which follows the pattern
> 
>    UPDATE tbl
>    SET field = (
>      SELECT SUM(field)
>      FROM tbl
>      WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED]
>      ) - field
>    WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED]
> 
> Any help?
> 
> -tkc (aka "the atomic swapper"? :)

Hehehe, that's a pretty neat trick... Could you write that in django ORM 
for me? ;-)))

Seeing I only need to do this very infrequently, I think I'll just do 
the 3 saves...

tmp = items.__class__.order_by("-field")[0].field + 1
tmp, i1.field = i1.field, tmp
i1.save()
i1.field, i2.field = i2.field, tmp
i2.save()
i1.save()

ugly, but gets the job done...


  - bram

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

Reply via email to