E
E
EvgenToHelp2022-02-22 14:33:29
Django
EvgenToHelp, 2022-02-22 14:33:29

Django Queryset how to create such a query?

There are two tables
Goods and Price history
. It is necessary to display the last price by date from the price history table.
On Sqlite it will turn out, but I can’t figure out how to do it through Queryset

SELECT name,max(date),price,price_discount FROM polls_products
INNER JOIN polls_history_price on polls_history_price.product_id = polls_products.id
GROUP BY polls_products.id

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question