sql - select query with Not IN keyword -
i have two tables below..
- tbpatientencounter
- tbvoucher
when execute select query
below
select encounteridp,encounternumber tbpatientencounter
it returens me 180 rows. and
select voucheridp,encounteridf tbvoucher
above query returns me 165 rows.
but want execute select query returns me data encounteridp not in tbvoucher, have tried below select query...
select * tbpatientencounter pe pe.encounteridp not in (select v.encounteridf tbvoucher v )
it doesn't returns row. in first image shows encounteridp 9 in tbpatientencounter
, not inserted in tbvoucher have tried select query
select * tbvoucher encounteridf = 9
it returns me 0 rows.
my question what wrong above not in query.?
in likelihood, problem null
values in tbvoucher
. try this:
select * tbpatientencounter pe pe.encounteridp not in (select v.encounteridf tbvoucher v v.encounteridf not null )
Comments
Post a Comment