I have a table like this:
id price condition username
----------------------------------------
1 20 New Kim
2 30 Used Kim
3 40 Used George
4 60 New Tom
My question is about subselection. when I use this query,
SELECT *
FROM `table`
WHERE `username` = 'kim'
AND `price` = '20'
OR `condition` = 'New'
it becomes true for the last condition and brings 2 records where condition = 'New'
However, when I use AND, it returns the correct record.
SELECT *
FROM `table`
WHERE `username` = 'kim'
AND `price` = '20'
AND `condition` = 'New'
I want to nest the query such that I can select price and condition only from the results of the first query, which is username. Thanks