0

Hi Guys,
I am looking to query a db having multiple brands of cars then from those results I want to further filter it based on the type of oil they use. I have written the below but it does not work and I am not sure how I can get this done.


I am trying to construct a mysql statement but I can't seem to get it right. I am pretty sure I can't use WHERE twice. Any help will be much appreciated.

SELECT *
FROM `details`
WHERE brand = 'audi' 
OR brand = 'toyota'
WHERE Oil ='Diesel'
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by pritaeas
0

Hi,
I have a follow up question on this. Say the user selects oil as diesel and the leaves the brand section empty. Then how would I show cars which are based on diesel of all the brands.

The above code works but it only works if the brands are provided. I need to give the user the flexibility to just choice the type of oil too.

Thank you in advance.
Vishal

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.