Answer the question
In order to leave comments, you need to log in
How to correctly form a mysql query?
Good afternoon, help me formulate the request correctly. If there is an example, I will be glad to see it visually.
the table consists of
brand (there are many different brands)
article (there are many articles, different brands can have the same article)
price
delevery
The output should be as follows:
three positions of the brand-article bundle
sorted
by the minimum price (first position) minimum delivery time (second position) and the ratio of price and delivery time (third position)
Is it possible to do this all in one request or do I need to make several requests with a limit of 1
Answer the question
In order to leave comments, you need to log in
Have you tried to write several different queries and combine them into one using UNION ?
The minimum and maximum is simple
SELECT brand, article FROM YourTable WHERE price = (SELECT MIN(price) FROM YourTable);
SELECT brand, article FROM YourTable WHERE delevery = (SELECT MIN(delevery) FROM YourTable);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question