I'm spacing on this. I'm sure it's simple, but I can't recall it.
I want to write a clause using a WHERE statement.
SELECT * FROM products WHERE orders_id = 1 ORDER BY products_model
This will work, but what if I want to get everything from where orders_id is 1, 2, 3, 4, 6, 10, 12, and 18? I want to report the values for all of those numbers. How would I go about doing that?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Just in case: it should probably be noted here that if those values come from another DB query, you could use a sub-query instead:
Code:
. . . WHERE col_name IN (SELECT id FROM some_table WHERE something=somethingelse)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks