F
F
freshik3122018-02-10 01:22:17
MySQL
freshik312, 2018-02-10 01:22:17

How are you with logic and sql queries?

Guys, I'm scratching my head, I need your help.
The situation is.
There are 2 tables 'product' and 'info';
In product - description of the product, price (prices are different), ...
In info - id (product), information about the product, date of purchase.
You need to find out the profit for a certain date or period of time.
Here's what I came up with...
You need to calculate the number of products, from info, purchased on a specific date, find out the price by their ID from the product table, multiply the price by the number of a certain product, and summarize these products ..
But later I decided to add a field with a price in info, now info has a price for 1 item, BUT by making a query
(SELECT SUM(price) FROM `info` WHERE info.buyer != '0' AND info.day = '10-02-2018'
) output i get thisprntscr.com/ickyhi
What can you advise how to implement it correctly so that only 60 would be obtained in the end?

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