Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query help needed
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01296873
Message ID:
01297077
Views:
31
>>>>And because it should be SQL Server compliant try:
>>>>That is of course if DateSaved is datetime field.
>>>>BTW Why not just use Datetime field?
>>>
>>>Well I have been witholding some information :) It is not VFP and it is not SQL Server, it is ADS (Advantage Database).
>>>I am stuck with a table and need to extract some data from it. I only have to do it once so I do not care if it is efficient..
>>>
>>>Anywho, there is a DateSaved field (not datetime, just date) and a TimeSaved field (not datetime, just time). I seem to recall that VFP also had just date and just time fields before. ADS is based on DBase like Fox was.
>>>
>>>Anywho I got side tracked on my quest for a query but I am hoping to get a chance to look into it this afternoon.
>>
>>Can you transform Date field to ISO 'yyyymmdd' style (In VFP we have DTOS() function)? and what is Time field? A regular Char of there is such type in ADS?
>
>ADS has a Time datatype, which is internally stored as the number of milliseconds since midnight in a 4-byte integer.

OK the same query, but you should find the right functions for converting:
SELECT YourTable.*;
       FROM YourTable;
INNER JOIN (SELECT Sh, MAX(ConvertDateToISO(DateSaved)+' '+ConvertTimeToString(TimeSaved)) AS DateTimeSaved;
                   FROM YourTable;
            GROUP BY Sh) Tbl1;
ON YourTable.Sh = Tbl1.Sh AND;
   ConvertDateToISO(YourTable.DateSaved)+' '+ConvertTimeToString(YourTable.TimeSaved) = Tbl1.DateTimeSaved
Where ConvertDateToISO() should convert your Date to string with folwong format "YYYYMMDD" and
ConvertTimeToString() should convert Time to string no matter what format it is, just make sure that 12:01 PM is bigger than 12:01 AM it could be:
"18:20", "1820", "66000" (that is 18*3600 + 20*60)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform