Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation between two rows

Status
Not open for further replies.

ahilsman

Technical User
Apr 7, 2005
1
US
I have a couple of questions.
I am using CR 11 and mySql DB.

I'm trying to calculate the elaped time between events for a simulator.

The elapsed time is the diffenece in time between records.

The Db stores the DateTime when the record was inserted as well as a projectID number. Two events, no matter what project they are for, can't go on at the same time.

Table: Log

Fields: logId as autonumber
ProjectId as integer
Time as DateTime

First when I sort the records by date in Acending order it does it correctly by date, but then it does it in decending order by time for each day? I have no idea why. I know MySql stores DateTimes as Strings.

Second my biggest problem is when I have to group the records by project then by month. How do I calculate the elapsed time since the records are no longer in order by time?

Thanks.
 
Split time from date, and you should be able to control how they sort.

For calculating elapsed time, you'd probably need a subreport which views the record by time and does the calculation.

Subreports make a lot of work for computers, but save time for humans. You decide which is more important for your particular circumstances.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top