根據Gdj(陈水.智商只有129.非卖品) 提供思路寫的if(b>0,b,a)>=$price and if(b>0,b,a)<=$price_a下面是我那天晚上寫的.死了我好多腦細胞.呵呵 ((($price<=b) and (b<=$price_a)) OR ((($price<=a) and (a<=$price_a)) and (b=0)))那個效率高些?
select b as res from tbl where b>0 and a=0 union select a as res from tbl where a>0 and b=0
。 有那么复杂么????michelle0618(小蝶) 就能满足lz需要阿!~
if(b=0){ select a from table }else{ select b from table }
((($price<=b) and (b<=$price_a)) OR ((($price<=a) and (a<=$price_a)) and (b=0)))那個效率高些?
有那么复杂么????michelle0618(小蝶) 就能满足lz需要阿!~
select a from table
}else{
select b from table
}
不过一般来说,很多人都喜欢用
union
这样 效率或许会稍为高点!