Can we use WHERE to limit what we see to two or more different categories?

If I want to limit what I see to contain info based on two restrictions, can I use WHERE twice?

For example, can I say:
FROM food
WHERE preptime < 10
WHERE ingredients <10;

Thanks so much for your help!

You can use multiple conditions in a SQL query, however you only use one WHERE statement. Instead of

WHERE preptime < 10
WHERE ingredients < 10;

You want to do

WHERE preptime < 10
AND ingredients < 10;

And you can add as many conditions as you want this way using AND and/or OR. Just ensure that your logic checks out for what you want to do or you may get unusual results.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.