SQL to detect when a record was entered

From: Alt255 <alt255.2005_at_gmail.com>
Date: Thu, 21 May 2009 06:17:14 -0700 (PDT)
Message-ID: <7d813a03-61b8-46de-9d62-64aa026f78cb_at_f16g2000vbf.googlegroups.com>



Hello all, this is a puzzle thats been bugging me for sometime, and now it looks like I *have* to build something.

I would like to know when a code number changed for an account in a delta table.
The table contains the account number, several code numbers, a row insert date and basically looks like this DPLH_ROW_EFFCT_DTE DPLH_PLAN_NUM USERID_NAM DPLH_SIOB_CDE DPLH_SLIQ_CDE

4/15/2009	   164328	LACSOA1	      99	      99
4/30/2009	   164328	LACSOA1	      5 	      99
5/19/2009	   164328	LACSOA1	      101	      105

There are many other fields, so records could be added unrelated to the code numbers I'm interested in. So my challenged is to identify any DPLH_PLAN_NUMs that have had their DPLH_SIOB_CDE or SLIQ_CDE changed. It seems I need to compare the last record to the second last record. Is this even possible? Received on Thu May 21 2009 - 08:17:14 CDT

Original text of this message