tsql - Comparing Query Changes. Is there a better way -


when writing queries, in steps. sometimes, in process realize i've made "mistake" such ending or losing records. so, typically compare 2 queries so:

(select blah blah blah ) mine  inner join  ((select blah blah blah ) orig mine.pk <> orig.pk 

or if i'm looking missing or records use left join instead , nulls.

is there better way figure out why 2 queries returning different numbers of records?

you need full join start with. inner join show records in mine not in orig. full join show in orig , missing in mine.

a quick , dirty way check differences compare result of checksum_agg(checksum(*))


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -