transformation question -
02-11-2005
, 11:30 AM
i have an auditing table that tracks field level changes to a record for any
given table. i'm trying to make a query (and need help) that takes entries
in the auditing table and puts them into a similar structure as the table
the audit represents...showing the changes to a record over time. any help
or suggestions would be great. here's what i'm trying to get to:
foo
"field1" "field2" "field3" "date"
"a" "b" "c" "11-feb-2005"
"z" "12-feb-2005"
"j" "13-feb-2005"
here's the table structure for the audit table:
auditing table..
company
tableid
fieldid
recordid
value
userid
stamp (date)
any table "foo"...
field1
field2
field3
gets new records stored in the audit table like this:
foo=
"a" "b" "c"
auditing=
"mycompany" "foo" "field1" "a" "a" "jblow" "11-feb-2005"
"mycompany" "foo" "field2" "a" "b" "jblow" "11-feb-2005"
"mycompany" "foo" "field3" "a" "c" "jblow" "11-feb-2005"
if i edit record "a" and change only one field (field3 a day later) the
auditing table would look like this:
"mycompany" "foo" "field1" "a" "a" "jblow" "11-feb-2005"
"mycompany" "foo" "field2" "a" "b" "jblow" "11-feb-2005"
"mycompany" "foo" "field3" "a" "c" "jblow" "11-feb-2005"
"mycompany" "foo" "field3" "a" "z" "szque" "12-feb-2005"
if i edit record "a" and change only one field (field2 a day later) the
auditing table would look like this:
"mycompany" "foo" "field1" "a" "a" "jblow" "11-feb-2005"
"mycompany" "foo" "field2" "a" "b" "jblow" "11-feb-2005"
"mycompany" "foo" "field3" "a" "c" "jblow" "11-feb-2005"
"mycompany" "foo" "field3" "a" "z" "szque" "12-feb-2005"
"mycompany" "foo" "field2" "a" "j" "szque" "13-feb-2005" |