query mysql in php to get the difference between two tables -


i have 2 tables same structure users finger print data , want first table data not exist in second table , insert second table structure of 2 tables:

  • id
  • user_id
  • check_time
  • check_type
  • sensor_id

you can use insert select from using additional join as

insert table2  select  t1.* table1 t1 left join table2 t2 on t1.user_id = t2.user_id , t1.check_time = t2.check_time t2.user_id null , t2.check_time null 

Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -