I am currently working with an audit log table similar to:
ID | EventTime | AccessID | AccessType | Status | Final ------------------------------------------------------------------------------ 1 | 2013/02/10 01:01:01 | NULL | 123 | 335 | OK 2 | 2013/02/10 01:01:01 | 985521 | NULL | 66 | OK .... 41 | 2013/02/10 07:07:07 | NULL | 456 | 335 | OK 42 | 2013/02/10 07:07:07 | 113228 | NULL | 66 | OK
I need to select AccessID and AccessType on the same line, AccessType .:
AccessID | AccessType ------------------------ 985521 | 123 113228 | 456
AccessID always unique and is only available on the line where Status = 66 . AccessType is only available where Status = 335 .
EventTime always used for status 335 and 66.
I tried to group the data by the time of the event using sub selects, etc., but I was not able to get the final result that I need.
Additional Information
Approximately 100,000 rows are added per day. For each EventTime, there are approximately 40 rows with different information (the number of columns is greater than the following)
source share