posts - 40, comments - 58, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          滿足任意幾個條件的查詢方法

          Posted on 2009-01-19 13:47 Astro.Qi 閱讀(212) 評論(0)  編輯  收藏 所屬分類: Oracle

          滿足5個條件中任意四個條件都可以的實(shí)現(xiàn)方法。

          一、使用case when實(shí)現(xiàn)

          select * from 表名
          where (case when 條件1 then 1 else 0 end + case when 條件2 then 1 else 0 end + case when 條件3 then 1 else 0 end + case when 條件4 then 1 else 0 end + case when 條件5 then 1 else 0 end) >= 10;

          主站蜘蛛池模板: 长治县| 乌兰县| 册亨县| 河曲县| 鹤岗市| 稻城县| 慈利县| 特克斯县| 德钦县| 加查县| 鹤岗市| 正宁县| 天峻县| 延长县| 娱乐| 连云港市| 桃江县| 阳江市| 台南县| 乐亭县| 延吉市| 肃宁县| 宁城县| 鄯善县| 彭水| 瓮安县| 天门市| 高碑店市| 张家口市| 达孜县| 靖安县| 甘泉县| 微山县| 康马县| 连江县| 天等县| 永清县| 铜鼓县| 万州区| 兰州市| 新河县|