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:
01297101
Views:
14
>Hi Borislav,
>
>Please check my suggestion. It may be slower, but no conversions are needed. First we filter the maximum date, then the maximum time for that date.

That was the first thing I did, but I didn't read it right.
(not formated as I like, I think)
It should work.
SELECT YourTable.*;
       from YourTable;
INNER JOIN (SELECT YourTable.Id,
                   YourTable.DateSaved
                   max(YourTable.TimeSaved) as MaxTime 
                   FROM YourTable
            INNER JOIN (SELECT Id, MAX(DateSaved) AS DateSaved
                              FROM YourTable
                        GROUP BY Id) Tbl1
                 ON YourTable.Id        = Tbl1.Id AND
                    YourTable.DateSaved = Tbl1.DateSaved);
            GROUP BY YourTable.Id, YourTable.DateSaved) sql ;
on YourTable.ID = sql.ID and YourTable.DateSaved = sql.DateSaved and YourTable.TimeSaved = sql.MaxTime
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform