sql - get Value that does not exist in another table and vice versa -


i have 2 table named lu_timepoint holds default timepoints , operational table called tbl_data. tbl_data contains details candidate , timepoint when has come lab test. timepoint range -30 mins 24 hrs

the lu_timepoint table lookup table default timepoints. need write query check whether timepoint in tbl_data exist in lu_timepoint table , if not there need have value false in column called checked. likewise if timepoint in lu_timepoint table not exist in tbl_data table need have value false in column checked. else true in checked column.

i tried left join i'm getting more rows count due incorrect join statement. below code used candidate id timepoint not equal other table

   select  distinct pt, pctpt      tbl_data s      left join lu_timepoint t      on s.study = t.study      s.pctpt = t.timepoint  

data attached in below link... table data

if want records doesn't exists in joined tabled , vice versa, can use full outer join display distinct values each table.

specifying database using , providing tables structures , of data build final query.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -