Is there a way in Django 1.3.7 to return multiple values from one extra select? For example I have two extra selects used to get two separate values, and i would also like to get their difference (I need to be able to filter on it) without needing an extra query:
invoices = invoices.extra(select={"value_storned_left":
add_invoice_storned_total_query()})
invoices = invoices.extra(select={"total_value_paid":
add_invoice_total_paid_query()})
I did not find a solution using annotate for this in Django 1.3 so I was wondering if can combine the two queries and also get the difference there and return 3 values from the same extra query, maybe get something like this:
invoices = invoices.extra(select={("value1", "value2", "value3"):
combined_query()})
Is there a way to do this and how would it look. The only method I found so far to do this was making and extra third query to get the difference, that uses what i do in the first 2 queries, so this takes longer and it;s heavier on the DB.
Thanks