Click to See Complete Forum and Search --> : Creating of query for choosing some records from a table (MS Access)


Sharkky
July 18th, 2003, 04:29 PM
There is a table of such view:

Employee name Activity
John TV repair
John Dog walking
John Hot-Dog eating
Bob first activity
Bob second activity
Bob third activity

I need to make a query to choose the second activity for each employee
How can I do it

Sharkky
July 18th, 2003, 04:45 PM
Table have corrupted, but I think the idea is still understandable

antares686
July 21st, 2003, 05:49 AM
You will need to add an autonumber field or better create a job# field for the employees so that you can designate them directly and be able to use that field for your query. As it is you have no way to get the true second item because you cannot simple order them based on any field to know for sure that was second.

You could just loop thu the recorset with an ADO connection and each time ou see a name look for the next item if the name is th same otherwise start over. But you still could run into sorting not being what you expected.