On Sep 30, 2009, at 10:55 PM, Joe Bennett wrote: > I'm not sure I'm far enough along with sqlite to maybe get what ya'll > are telling me...
Right... with SQL it helps to thing in terms of set operations instead of procedural code... here is an illustration to get you started: "A Visual Explanation of SQL Joins" http://www.codinghorror.com/blog/archives/000976.html To further confuse you: "Double-thinking in SQL" http://explainextended.com/2009/07/12/double-thinking-in-sql/ > Have two tables that have the same columns, but different number of > rows (rows do not match but columns do. 86 matching columns in each > table): Right... here is sketch of a possible query: select TableA.Column1 as Column1_A, TableA.Column2 as Column2_A, case when coalesce( TableB.Column3, '?' ) = coalesce( TableA.Column3, '?' ) then '=' else '!=' end as Column3, coalesce( TableA.Column3, '?' ) as Column3_A, coalesce( TableB.Column3, '?' ) as Column3_B, case when coalesce( TableB.Column4, '?' ) = coalesce( TableA.Column4, '?' ) then '=' else '!=' end as Column4, coalesce( TableA.Column4, '?' ) as Column4_A, coalesce( TableB.Column4, '?' ) as Column4_B from TableA left join TableB on TableB.Column1 = TableA.Columns1 and TableB.Column2 = TableB.Columns1 where TableB.Column1 is null or coalesce( TableB.Column3, '?' ) != coalesce( TableA.Column3, '?' ) or coalesce( TableB.Column4, '?' ) != coalesce( TableA.Column4, '?' ) In other words, for all rows in TableA, show me all the rows in TableB which do not match TableA, either because they don't exist in TableB in the first place ("TableB.Column1 is null") or because one of their value is different ( "TableB.Column3 != TableA.Column3" ). _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users