I stuck in a situation for using a conditional block statement: So I want to know which give fast
performance between mysql case expression and if-else condition.
My expression as follows
Php condition block:
$data=mysql_fetch_assoc(mysql_query("select action,state from my_table")); if($data['action']==2 && $data['state']==0){ $state=1; } else{ $state=0; }
MySql condition :
$data=mysql_fetch_assoc(mysql_query("select case when action = 2 and state = 0 then 1 else 0 end as state")); $state =$data['state'];
I need a faster solution for it. So please tell me which is more recommended.