469,646 Members | 1,334 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

Any approach to write query for finding data inconsistencies from multiple tables

4
Hi,

I have three tables with columns as:

Person_sys1
Id(pk) name telephoneNum userid
----- -------- ---------------------- ---------

Person_sys2
Id(pk) name telephoneNum userid
----- -------- ---------------------- ---------

Telephone
telId(pk) telephoneNum personId
------ ---------------------- -------------

Data is populated through some application sync logic. Telephone <---> Person_sys2 <---> Person_sys1
Also these tables does not have foreign key relationship.

Now I need to write a query/ies ( single would be better) which would give me inconsistent rows of all there table for the following column mismatch (name,userid and telephoneNum).
If my data is consistent I should get zero rows otherwise rows that are mismatching for the below mentioned column values as per mapping.


Column Mapping (Arrow signifies sync direction) is as below:
-------------------------------------------
Person_sys1.name ------> Person_sys2.name
Person_sys1.userid ------> Person_sys1.userid
Person_sys1.telephoneNum <------ Person_sys1. telephoneNum <------ Telephone.telephoneNum

TIA.
Jul 16 '07 #1
0 839

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Rigga | last post: by
4 posts views Thread by DBNovice | last post: by
5 posts views Thread by Sumana | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.