Jimmy,
Datetime values are stored with millisecond level precision and we don't have access to the miliseconds, so using datetime in a join is rarely going to succeed. You need a UDF to convert your datetime to a minute precision value.
function MinuteDateTime( ltValue )
return left( ttoc( ltValue, 1 ), 12 )
YOu can seed your curdates cursor
ltend=datetime()
ltstart=ltend- 24 * 60 * 60
CREATE CURSOR curDates (cMinute c(12) )
do while ltstart<=ltend
INSERT INTO curdates (cMinute) VALUES ( MinuteDatetime( ltstart ) )
ltstart=ltstart+60
enddo
and then join:
SELECT curDates.cMinute, * FROM registrations
LEFT JOIN curdates
ON MinuteDateTime( Registrations.datetime ) = curdates.cMinute ;
ORDER BY curdates.cMinute
into cursor ctest
>I would like to have a cursor as result with for each minute of the day a registration value if there is no registration for that period then I will change to .null. value to 0.
>
>ltend=datetime()
>ltstart=ltend-7200
>*the seconds are changed to zero.
>
>CREATE CURSOR curDates (dDatetime T)
>do while ltstart<=ltend
> INSERT INTO curdates (dDateTime) VALUES (ltstart)
> ltstart=ltstart+60
>enddo
>
>SELECT * FROM registrations right JOIN curdates ON Registrations.datetime=curdates.dDatetime ;
> ORDER BY curdates.dDateTime into cursor ctest
>
>With this SQL-command I don't get a result the value-field is empty for all the dDatetime-records ??