简体   繁体   中英

How do I compare tables of different sizes in sql?

I need to compare a smaller table to a larger table. The smaller table is comprised of 3 fields that recur in the larger table. One of the fields is an id. Another is an area measurement. The last is a string. I need to mark the records in the larger table that have values that disagree with values in the smaller table for a given id. The smaller table has at most 60% of the entries of the larger table. I need to account for duplicates.

I've looked around an I haven't found any real discussion on the topic. I'll be using sqlite3 for this.

A = small table B = large table

select * from B, A
where A.ID = B.MatchingField
AND (A.Measurement <> B.Measurement
OR A.String <> B.String)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM