Untested select table1.col1 as Key, table1.col2 as T1C2, table1.col3 as T1C3, table1.col4 as T1C4, table2.col2 as T2C2, table2.col3 as T2C3, table2.col4 as T2C4 from Table1 join Table2 on Table1.Col1=Table2.Col2 order by table1.col1
On Sun, Jul 28, 2013 at 10:44 PM, Fehmi Noyan ISI <fnoyan...@yahoo.com>wrote: > Hi, > > I would like to compare two tables row by row having same primary keys. > The comparison should take each row from TABLE1 and find relevant entry > (based on KEY) from TABLE2 and compare value of EACH column. > > For the TABLE1 and TABLE2 below, the values of COL4 for KEY3 should be > returned (both values). > > TABLE1 > > COL1 COL2 COL3 COL4 > KEY1 X Y Z > KEY2 A B C > KEY3 K L M > > TABLE2 > > COL1 COL2 COL3 COL4 > KEY1 X Y Z > KEY2 A B C > KEY3 K L D > > > Is there a way to do this via SQL or I will try to do it with C loops > (which ends up with nasty code!). > > Thanks in advance... > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users