Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

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

 
   Database Forums (Home) -> mySQL RSS
Next:  SQL Server Setup + System Resources  
Author Message
Nick

External


Since: Jul 09, 2007
Posts: 1



(Msg. 1) Posted: Mon Jul 09, 2007 6:59 am
Post subject: Compare record in two tables, return fields that don't match...
Archived from groups: mailing>database>mysql (more info?)

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.

 >> Stay informed about: Compare record in two tables, return fields that don't mat.. 
Back to top
Login to vote
Omar Langset

External


Since: Jul 09, 2007
Posts: 1



(Msg. 2) Posted: Mon Jul 09, 2007 12:56 pm
Post subject: Re: Compare record in two tables, return fields that don't match... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Nick wrote:
> 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 ..... )

 >> Stay informed about: Compare record in two tables, return fields that don't mat.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SQL Query: Return fields corresponding to comma separated .. - I'm attempting a query that gathers product data for a particular product id. One of the items is designer(s) which can be more than one. The product table has comma separated id's of the designers in the designers table (which has fields like: id,..

two tables selecting fields - Suppose I have two tables A and B Table A has fields A1, A2, A3, ... A9 Table B has fields B1, B2, B3, ... B9 I want to select all fields in A and only B3 in table B. I dont want to list individual fields for A because they are too many I simply want t...

exporting tables with password fields - I am making a copy of a dB on my local machine so I can work on the interface. But the username/password combination -- which works on the "live" site -- doesn't work on my local machine. Is there something about the PASSWORD() fxn in mysql ...

getting two distinct fields from one tbl from a join query.. - Hi Help! Im stuck on a join query. Im trying to get distinct (the same row returned only once) user_id and forename from a tbl of users (they are always distinct) where user_id in that tbl equals friend_id in another table friend_id, which 'should' be....

Check record reference by other tables - Hello all, Suppose I have 2 tables order and product. In order table it have a field named product_id which refers to primary key ID of product table. e load Now someone wants to change details in product table such as the price but this action will..
   Database Forums (Home) -> mySQL All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]