sql - select query with Not IN keyword -


i have two tables below..

  1. tbpatientencounter
  2. tbvoucher

when execute select query below

select encounteridp,encounternumber tbpatientencounter 

enter image description here

it returens me 180 rows. and

select voucheridp,encounteridf tbvoucher

enter image description here

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

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -