Jump to content

[SOLVED] Merge multiple conditions in to one?


Loriq

Recommended Posts

What is the proper way to do this as one condition, instead of multiple conditions connected by ands?

 

This is how it's being made right now

 

select `stuff` from `table` where `tinyint`&~15 = 32 and `tinyint`%16 = 10

select `stuff` from `table` where `tinyint`&~15 =  2 and `tinyint`%16 = 3

select `stuff` from `table` where `tinyint`&~15 = 64 and `tinyint`%16 = 0

select `stuff` from `table` where `tinyint`&~15 = 16 and `tinyint`%16 = 13

etc..

 

and the PHP code

 

$query='select `stuff` from `table` where `tinyint`&~15 = '.($var1<<4).' and `tinyint`%16 = '.$var2;

 

 

But I want to make it into a single condition so that MySQL will only need to check once. How do I do this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.