Saturday, May 5, 2018

(00 01 10 11 Condition Query) Tayyab Bhai Class

https://plsqlquery.blogspot.com/2018/05/dsf.html

To Query the Records which is not Equal in two Columns and one Column containing Null Value through Union

select fv.TAG_NUMBER, fv.ASSET_NUMBER from fa_additions_b fv
where fv.ASSET_NUMBER!=fv.TAG_NUMBER
union
select fv.TAG_NUMBER, fv.ASSET_NUMBER from fa_additions_b fv
where fv.TAG_NUMBER is null

---------------------------------------------------

To Query the Records which is not Equal in two Columns and one Column containing Null Value through one Condition

select nvl(fv.TAG_NUMBER,'ABC'), fv.ASSET_NUMBER
from fa_additions_b fv
where
nvl(fv.TAG_NUMBER,'ABC')  !=   fv.ASSET_NUMBER

--------------------------------------------------

create table abc
(TAG_NUM VARCHAR2 (10),
ASSET_NUM varchar2 (10));

select * from abc

insert into abc
values (4,5);

     TAG_NUM  ASSET_NUM
1         1
2                               2
3
4        3                     3
5        4                     5

in which 3 is null
------------------------------

To Query the Records which is not Equal in two Columns and one Column containing Null Value or both Columns are null through different Conditions

select *
from abc fv
where
fv.Tag_Num is null
or fv.asset_num is null
or fv.asset_num not like fv.tag_num

----------------------------

To Query the Records which is not Equal in two Columns and one Column containing Null Value or both Columns are null through one Condition

select fv.TAG_NUM, fv.asset_num
from abc fv
where
nvl(fv.TAG_NUM,'A')!= nvl(fv.asset_num,'B')

No comments:

Post a Comment

XLA to GL Link

  https://plsqlquery.blogspot.com/2025/12/xla-to-gl-link.html SELECT             acr.cash_receipt_id,             acr.receipt_number,       ...