Hello,
I know that subject is quite clueless, so I explain my need with a clear example.
I have a table, let's name it "LOG", with the following data:
TABLE: LOG
Time Type A B C D
================================
15:01 INS 10 10 10 10
15:02 UPD 10 20 10 10
15:03 UPD 50 20 10 30
15:04 UPD 50 10 10 30
This table logs which action was taken (INSERT, UPDATE) in a certain table, and saves each field value (columns A to D).
My goal is to write a SELECT statement that, reading data from the LOG table, outputs the following:
Time Type Column Oldvalue Newvalue
============================================
15:01 INS A (NULL) 10
15:01 INS B (NULL) 10
15:01 INS C (NULL) 10
15:01 INS D (NULL) 10
15:02 UPD B 10 20
15:03 UPD A 10 50
15:03 UPD D 10 30
15:04 UPD B 20 10
That is, to display one record for each column value change.
Is there any chance to do it?
Thank you