I've been working with sql for years but my limited knowledge of it has finally caught up with me. I'm working in a web scripting environment where I'm using odbc to run sql statements against an access db.
I have a table with contains entries for time spent on projects by an employee. Each record contains a start and stop time for when the work was performed and a description of the work. A person might work on the same task for several days and have a record for each day with the same description of what they were doing. I want to provide a drop down list containing the last ten descriptions a person used ordered by the description name.
I basically need to sort the entries by date, retrieve the last ten distinct descriptions, and then order them by the description name. I'm trying to find if there is a way to do this in sql without having to use the "brute force" method on the query results.
The first two steps are where I'm really having trouble. I can't seem to find a way to get a distinct lising on the "description" field without losing the date information so I can take the last ten used by the employee. I don't want them to see a description that was used ten months ago, I want them to see the most recent descriptions.
Any help would be much appreciated,
GJ
I have a table with contains entries for time spent on projects by an employee. Each record contains a start and stop time for when the work was performed and a description of the work. A person might work on the same task for several days and have a record for each day with the same description of what they were doing. I want to provide a drop down list containing the last ten descriptions a person used ordered by the description name.
I basically need to sort the entries by date, retrieve the last ten distinct descriptions, and then order them by the description name. I'm trying to find if there is a way to do this in sql without having to use the "brute force" method on the query results.
The first two steps are where I'm really having trouble. I can't seem to find a way to get a distinct lising on the "description" field without losing the date information so I can take the last ten used by the employee. I don't want them to see a description that was used ten months ago, I want them to see the most recent descriptions.
Any help would be much appreciated,
GJ