SELECT id, ((positive_count + 1.9208) / (positive_count + negative_count) -
1.96 * SQRT((positive_count * negative_count) /
(positive_count + negative_count) + 0.9604) /
(positive_count + negative_count)) / (1 + 3.8416 /
(positive_count + negative_count))
AS ci_lower_bound FROM widgets WHERE positive_count + negative_count > 0
ORDER BY ci_lower_bound DESC;
This is what I have to do (ordering objects)..
The issue with my table is, I don't have positive_count, negative_count fields
separately!!
The CountTable table has a boolean field "count" which is either positive or
negative. This table uses contenttypes to attach to other model objects.. and I
use reverse generic relation to identify list of counts a object got (whether
positive or negative).
How to pass positive_count, negative_count into this above query? (in raw sql)
or else can we use conditional statements in .order_by()??
thanks!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.