Code:
select distinct item_code ,item_description ,item_type_name,item_group_name
from tblitemmaster
minus
select distinct item_code ,item_description ,to_char(null) as item_type_name, to_char(null) as item_group_name
from tblbinlocation
where transaction_type in('Indent','MDN')
and voucher_date
between TO_CHAR(TO_DATE('01-03-2014', 'DD-MM-YYYY'))
and TO_CHAR(TO_DATE('31-08-2014', 'DD-MM-YYYY'))
Insted of the above query am using not exists
Code:
select distinct item_code ,item_description,item_type_name,item_group_name
from tblitemmaster
where not exists (select distinct item_code from tblbinlocation
where tblitemmaster.item_code = tblbinlocation.item_code
and transaction_type in('Indent','MDN') and
voucher_date
between TO_CHAR(TO_DATE('01-03-2014', 'DD-MM-YYYY'))
and TO_CHAR(TO_DATE('31-08-2014', 'DD-MM-YYYY')))
Minus and not exists concepts are same.but,the two queries are getting different output.2nd query only correct output.
How to alter the 1st query and i want correct result like 2nd query.
Thanks in advance.
Comment