select ... where id = any value. is it possible?
mysql, php, phpmyadmin
Solution
Well, it's kind of a hack, but if you really need to do this, it'll work like this:
select `id` from `table` where `name` = 'something' and `order` = `order`
Then you're just saying "wherever order is the same as itself", so it's always true.
Problem
look at this table please ``` table |id| |name| |order| ``` i must get the rows, where `name = something` and `order = somevalue` so i write ``` select `id` from `table` where `name` = 'something' and `order` = 'somevalue' ``` but depend on php logic, sometimes i need to get all rows, where `name = something`, independently of `order` value. i don't want to change the query structure, because in practise there are many number of fields, and possible count of queries will become very big. so i want to save the structure of query, and when i need to select just by name, i want to write something like this: ``` select `id` from `table` where `name` = 'something' and `order` = any value ``` is it possible? thanks