Connecting Tech Pros Worldwide Help | Site Map

Compare record in two tables, return fields that don't match...

  #1  
Old July 9th, 2007, 03:05 PM
Nick
Guest
 
Posts: n/a
Does anyone know if there is an easy way to compare a row from table
a, to a row in table b with the same structure/field names and return
those fields which don't match?

I have table_a storing the originally submitted applicant information,
and table_b storing a version that can be changed. When a user makes a
change I'd like to compare it to the original table to see what fields
were changed, preferably without opening the row from both tables and
going field by field in code to see if they match...

Thank you for the help!

Nick Smith
Application Developer
Influent Inc.

  #2  
Old July 9th, 2007, 05:15 PM
Omar Langset
Guest
 
Posts: n/a

re: Compare record in two tables, return fields that don't match...


Nick wrote:
Quote:
Does anyone know if there is an easy way to compare a row from table
a, to a row in table b with the same structure/field names and return
those fields which don't match?
>
I have table_a storing the originally submitted applicant information,
and table_b storing a version that can be changed. When a user makes a
change I'd like to compare it to the original table to see what fields
were changed, preferably without opening the row from both tables and
going field by field in code to see if they match...
>
Thank you for the help!
>
Nick Smith
Application Developer
Influent Inc.
>
This should work

select * from table_a a, table_b b where a.applicantId = b.applicantId
and ((a.row1 != b.row1) or (a.row2 != b.row2) or ..... )
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 11:37 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 09:56 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 03:15 AM
How to compare fields from similar tables Megan answers 5 November 13th, 2005 02:06 AM