Saturday, November 26, 2016

Re: ORM PostgreSQL stuff

I didn't quite understood the question, you want to find the division of two prices for each item, but each item has only one price according to the model you posted.

can you express what you want to accomplish in python or SQL?

On Sat, Nov 26, 2016 at 10:15 PM, Artem Bernatskyy <artem.bernatskyy@gmail.com> wrote:

Hello

Is it possible to do in ORM or in PostgreSQL

Assume we have a table with date and price

# class Item(models.Model):
#    price = models.DecimalField()
#    date = models.DateField()

We need for every item in table find division of two prices by two dates and then order_by that result of division


P.S. i can accomplish this via signals but... i don't want to create no more denormalized tables

Tnx in advance :)

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b1b53243-1ba6-4ff9-8493-35519620b3f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tJsuf%3Ds8QhbA1W81_mkZ%2BReBt1tm8n%3D6XjCSTkbMHL08A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment