ok here is the deal, i am using MS SQL 7 and CR8, i am subtracting a date time from another date time field with this formula in CR8 using the fields from my database tables.
************************************************************
Datevar StatusCallTime := date({tblUnitRadioHistory.LastActionTime});
Datevar CallTime := date({tblDisHead.CallTime});
Numbervar SecondsBetweenDate := (StatusCallTime - CallTime) * 8640;
Numbervar SecBetweenTime := (Time({tblUnitRadioHistory.LastActionTime}) -
Time(0,0,0)) - (Time({tblDisHead.CallTime}) - Time(0,0,0));
SecondsBetweendate + SecBetweenTime / 60;
************************************************************
the problem comes in the ms sql database, it uses miliseconds, so there fore my select distinct is useless for reapeat records with the same LastActionTimes, because the milliseconds are returned with my SQL statements.
************************************************************
SELECT DISTINCT
tblDisHead.Dispatch#,
tblDisHead.CallTime,
tblUnitRadioHistory.RadioID,
tblUnitRadioHistory.CurrentDispatch#,
tblUnitRadioHistory.ColorCmd,
tblUnitRadioHistory.LastActionTime,
tblCallStatus.StatusCode,
tblCallStatus.StatusDescription,
tblCallStatus.StatusType
FROM
(CAD_demo.dbo.tblDisHead tblDisHead INNER JOIN CAD_demo.dbo.tblUnitRadioHistory tblUnitRadioHistory ON tblDisHead.Dispatch# = tblUnitRadioHistory.CurrentDispatch#) LEFT JOIN XAP_demo.dbo.tblCallStatus tblCallStatus ON tblUnitRadioHistory.ColorCmd = tblCallStatus.StatusCode
WHERE
tblCallStatus.StatusType = 'B' OR tblCallStatus.StatusType = 'U'
ORDER BY
tbldishead.Dispatch# ASC, tblUnitRadioHistory.LastActionTime ASC, tblUnitRadioHistory.RadioID ASC
************************************************************
do i need to somehow modify my sql statement, or my formula or what?
************************************************************
Datevar StatusCallTime := date({tblUnitRadioHistory.LastActionTime});
Datevar CallTime := date({tblDisHead.CallTime});
Numbervar SecondsBetweenDate := (StatusCallTime - CallTime) * 8640;
Numbervar SecBetweenTime := (Time({tblUnitRadioHistory.LastActionTime}) -
Time(0,0,0)) - (Time({tblDisHead.CallTime}) - Time(0,0,0));
SecondsBetweendate + SecBetweenTime / 60;
************************************************************
the problem comes in the ms sql database, it uses miliseconds, so there fore my select distinct is useless for reapeat records with the same LastActionTimes, because the milliseconds are returned with my SQL statements.
************************************************************
SELECT DISTINCT
tblDisHead.Dispatch#,
tblDisHead.CallTime,
tblUnitRadioHistory.RadioID,
tblUnitRadioHistory.CurrentDispatch#,
tblUnitRadioHistory.ColorCmd,
tblUnitRadioHistory.LastActionTime,
tblCallStatus.StatusCode,
tblCallStatus.StatusDescription,
tblCallStatus.StatusType
FROM
(CAD_demo.dbo.tblDisHead tblDisHead INNER JOIN CAD_demo.dbo.tblUnitRadioHistory tblUnitRadioHistory ON tblDisHead.Dispatch# = tblUnitRadioHistory.CurrentDispatch#) LEFT JOIN XAP_demo.dbo.tblCallStatus tblCallStatus ON tblUnitRadioHistory.ColorCmd = tblCallStatus.StatusCode
WHERE
tblCallStatus.StatusType = 'B' OR tblCallStatus.StatusType = 'U'
ORDER BY
tbldishead.Dispatch# ASC, tblUnitRadioHistory.LastActionTime ASC, tblUnitRadioHistory.RadioID ASC
************************************************************
do i need to somehow modify my sql statement, or my formula or what?