Comparing two rows in mysql with additional check -


heysa,

i have little problem im not quite @ mysql queries , don't know proper terminology question i'll roll can :)

i have 2 rows in 1 table want compare if not 0 , equal. in php this:

if(!empty($row1) && !empty($row2)){    if($row1==$row2){        return true;    }else{       return false;    } }else{    return false; } 

here table if that's help

id | b | t | ----------- 1 | 2 | 1 | 2 | 0 | 0 |  3 | 1 | 1 | 

and this:

select * table b=t 

returns 0=0 record id=2 ( don't want )

correct query should return record id=3

select * table b = t , b <> 0 , t <> 0

since we're testing b = t, know if b <> 0 true, t <> 0 true. can therefore shorten to

select * table b = t , b <> 0


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -