首页 > 代码库 > oracle or语句的坑

oracle or语句的坑

SELECT SUM(tjo.pay_amount) FROM tb_jf_order tjo,tb_jf_gateway_trade_log tjg
WHERE  tjo.order_id = tjg.biz_id AND 
tjo.user_id = tjg.user_id    AND 
(tjg.trade_type=p OR tjg.trade_type=t) AND 
tjo.user_id=34322AND 
tjo.order_state=88 AND 
tjo.order_type NOT IN (0024,0022,0026) AND 
tjo.order_date = to_char(SYSDATE,yyyyMMdd);

1、上述sql中如果的两个or语句一定要赢括号括起来。

oracle or语句的坑