I have 2 tables Individual(IndividualId is primary key) and IndividualAudit. Every time update is made on individual table record goes to audit table. There are many columns that can be modified but i am interested only in picking up records where SSN is modified. I m using below query:
Select DI.IndividualId,DI.ssn FRom Individual I
INNER JOIN IndividualAudit A
ON(I.IndividualId = A.IndividualId and A.UpdateDate = GETDATE())
where i.updatedate = GETDATE() and I.ssn <> a.ssn
group by I.IndividualId,I.ssn
Can someone please tell me whether my approach is correct.
Actually i was searching on google and got scared looking at below link: Query help when using audit table
the person who answered similar query on this post seem to be very good with sql and comparing with his answer my approach looks quite naive. so i just want to know where am i wrong in my understanding.
Thanks a lot