Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Left join
Message
From
27/06/2002 02:27:44
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00672381
Message ID:
00672792
Views:
10
Thanks,
I think that was my problem!

>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 && 7200 is only 2 hours earlier
>*the seconds are changed to zero.
>
>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 ??
Previous
Reply
Map
View

Click here to load this message in the networking platform