lundi 4 mai 2015

SQLite Query for Two table Comparision

I want to compare two tables with same structure and want desired result

Table 1

id    |    name   |   value  |   rank 
123       john          0         0
564       jacky         0         0        
121       lia           0         0
321       jia           1         5

Table 2

id    |    name   |   value  |   rank 
123       john          1         7
121       lia           0         0
321       jia           1         5
432       jai           1         2
213       hisar         1         2

Final Result (to be expected)

id    |    name   |   value  |   rank 
123       john          1         7
121       lia           0         0
321       jia           1         5
432       jai           1         2
213       hisar         1         2
564       jacky         0         0

In the Above comparision if "value" column field is 1 then only change rank otherwise keep as it is and check for any new record

Aucun commentaire:

Enregistrer un commentaire