Answer the question
In order to leave comments, you need to log in
How to write a SQL Join query?
Please help me to create a query to get the lowest price value among all values that have category_id = 10
id = product_id in another table
Table 1
id - price
1 - 100
2 - 300
3 - 50
Table 2
product_id - category_id
1 - 10
2 - 10
3 - 11
Answer the question
In order to leave comments, you need to log in
SELECT
min(price)
FROM
table1
WHERE
id IN (
SELECT DISTINCT
(product_id)
FROM
table2
WHERE
category_id = 10
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question