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.