> Seems to work now with:
> w=240
> pricelisttable_set.extra(where=["""(table_pricelisttable.width - %s)
> >= ( SELECT Min(Abs(pl.width - %s)) FROM table_pricelisttable pl)
> """], params=[w, w])[0]

I would be very surprised if it works now as described with ">="
rather than "=".  It's basically asking for anything where the
difference between the target and the width is
greater-than-or-equal to the minimum difference.  Thus, this
looks like it would return your whole dataset.  It sounded like
you were only interested in those PriceList items where the width
was closest to (equal to) the minimum difference.

-tim






--~--~---------~--~----~------------~-------~--~----~
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