I'm not sure I'm far enough along with sqlite to maybe get what ya'll
are telling me... I'll try explaining it this way...


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):

TableA:

Column1    Column 2    Column3     Column4
Row1Data  Row1Data   Row1Data    Row1Data
Row2Data  Row2Data   Row2Data    Row2Data
Row3Data  Row3Data   Row3Data    Row3Data
Row4Data  Row4Data   Row4Data    Row4Data


TableB:
Column1    Column 2    Column3     Column4
Row1Data  Row1Data   Row1Data    Row1Data
Row2Data  Row2Data   Row2Data    Row2Data



Now, I'm looking to do this:

Find the first row of data in TableB, take Column1 and Column2's data
from row one and see if that data exists in TableA. Something like
this: SELECT * FROM TableA WHERE Column1=Row1Data AND
Column2=Row1Data.

When the corresponding data is returned from TableA, I then want to
check each column in the returned row from TableA matches its
cooresponding column/ row in TableB... If there is not a match, let me
know... Then move on to the next row in TableB and do it all over
again....

I'm attempting to do this in Python and am wondering if it would be
easier to do this with a query or bring each row in as a dictionary
and compare...???


-Joe

On Tue, Sep 29, 2009 at 2:39 PM, Petite Abeille
<petite.abei...@gmail.com> wrote:
>
> On Sep 29, 2009, at 6:50 PM, Cory Nelson wrote:
>
>> i believe he means except, not minus.
>
> Correct. Got my SQL dialects intermingled :)
>
>> If all you need is differing
>> rows, this will work like a charm.  Otherwise if you need a more
>> fine-grained delta like only returning columns that changed, you will
>> need a more complex (but still pretty simple) join.
>>
>> SELECT * FROM t_foo EXCEPT SELECT * FROM t_bar;
>
> And for the "fancy" join, something like:
>
> select     *
> from       bar
> left join  foo
> on         foo.id = bar.id
> where      foo.id is null
> or         foo.baz != bar.baz
>
> etc...
>
> As always, details might vary.
>
>
> _______________________________________________
> 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

Reply via email to