mysql: select ... where id = any value. is it possible?

Posted by Syom on Stack Overflow See other posts from Stack Overflow or by Syom
Published on 2010-05-20T22:35:36Z Indexed on 2010/05/20 22:40 UTC
Read the original article Hit count: 290

Filed under:
|
|

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 = somethimg, 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 became 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?

maybe the question is incomprehensible, at least i tried;) sorry for bad english

thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql