Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Audit trail processing
Message
From
09/10/2000 21:55:08
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00426982
Message ID:
00427120
Views:
20
Andrew,

You're absolutely right!

I was focusing on the index part, which nobody else had suggested, and "air coded" the rest. ;-)

You're right about the DATETIME() but Todd may be using something that is set in stone. I really do hope the fields aren't called "Date" and "Time."


>Cindy,
>
>Hate to bee nitpicky, but won't your SQL ignore all the transactions that happen before 18:00 regardless of whether they happened after the transaction in question (eg the next morning)?
>
>Looks like a great case for a DateTime field <g>.
>
>Failing that you could change the SQL statement to
SELECT * FROM Audit_trail ;
>   WHERE Date > lcLog_key_date OR ;
>      (Date = lcLog_key_date AND Time >= lcLog_key_time) ;
>   ORDER BY ...
>Cheers,
>
>Andrew
>
>

>
>>Todd,
>>
>>LOCAL lcLog_key_date, lcLog_key_time
>>SELECT Audit_trail
>>INDEX ON Color + Date + Time TAG MyTag
>>
>>IF SEEK([GREEN], [Audit_trail], [MyTag])
>>    lcLog_key_date = Audit_trail.Date
>>    lcLog_key_time = Audit_trail.Time
>>
>>    SELECT * FROM Audit_trail ;
>>        WHERE Date >= lcLog_key_date AND Time >= lcLog_key_time ;
>>        ORDER BY ...
>>ENDIF
>>
>>
>>
>>
>>>I need to select all the records from an audit trail after a key value changes. What I have is like this:
>>>
>>>date     time     color
>>>20001001 18:03:12 RED
>>>20001001 18:03:13 PINK
>>>20001001 18:03:14 ORANGE
>>>20001001 18:03:15 TEAL
>>>20001001 18:03:16 GREEN
>>>20001001 18:03:17 YELLOW
>>>20001001 18:03:18 BLACK
>>>20001001 18:03:19 WHITE
>>>
>>>
>>>I need to select from the green down. I've been doing it like this:
>>>
>>>select *, date+time as logkey from audit_trail into cursor stuff
>>>select * from stuff where log_key >= (select log_key from stuff where color = "GREEN")
>>>
>>>
>>>The problem is that there may be more than one green record, but I need to select all the changes since the first green record. I thought about using TOP, but that doesn't work in a sql select.
>>>
>>>Thanks!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform