Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can I ask where clause to satisfy two (and) conditions simultaneously

Mohammed SardarSep 23 2014 — edited Sep 24 2014

Hi,

I have written few joins and usually at the final stage a where condition with certain conditions to be satisfied in where clause. In all the conditions in where I want only one and condition to be satisfied only if both are true.

If we look at the below funciton I should satisfy is (get_order_type(ogr.order_number) <> 'R')) AND wh1.third_party_warehouse != 'Y') but I'm not getting rid off both which if order_type is'R' they are removed and if tooling_group is yes then ther are removed from the result. I'm trying with both below highlighted  Jointly how can check these conditions ? Can I do that in where clause?

((sg.tooling_stock_group <> 'Y')

        and

        (get_order_type(ogr.order_number) <> 'R'))

FROM order_goods_received ogr

        LEFT JOIN part_master pm

        on ogr.part_number =  pm.part_number

        --left join stock_groups sg

        left join stock_groups sg

          on pm.stock_group = sg.stock_group

          and ((sg.tooling_stock_group != 'Y') 

          and (get_order_type(ogr.order_number) != 'R'))

        --ON pm.stock_group = sg.stock_group        

        LEFT JOIN batch_record_1 br1

        --- SOME MORE CODE HERE -------

            WHERE ((ogr.delivery_date >= trunc (start_date))

                AND

               (ogr.delivery_date  <=  trunc(end_date)))

        AND

        ogr.goods_received_number <> '1' AND

        get_order_type(ogr.order_number) NOT IN ('L') AND

        ogr.returned_to_supplier_indicator not in('S','L') and

        --sg.tooling_stock_group <> 'Y'

        --((sg.tooling_stock_group <> 'Y') and (get_order_type(ogr.order_number) not in ('R')) )

        --(get_order_type(ogr.order_number) <> 'R' AND sg.tooling_stock_group <> 'Y')

        ((sg.tooling_stock_group <> 'Y')

        and

        (get_order_type(ogr.order_number) <> 'R'))

        AND wh1.third_party_warehouse != 'Y'

        UNION

        (

Thanks.

This post has been answered by BluShadow on Sep 24 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2014
Added on Sep 23 2014
8 comments
2,091 views