Results 1 to 9 of 9
  1. #1
    acs_one is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    5

    Select changes in the years

    I have a table with list of employees.


    For each employee there are name, surname, start_date, end_date, department.
    Each employee has one record for each year, then if one has worked for n years in the company in the table there are n rows.

    Now, I have to select only the employees that in the several years have changed their department.

    How can I do?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What on earth are in all of the records? If they are all as you have described for that first record then you may wish to revisit the design. You may just be starting to experience the problems with the design. There *will* be others.

  3. #3
    acs_one is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    5
    I can't revisit the design because I take this datas from an export given by a program not managed by me and where I haven't an access to DB.
    This program gives me a unique big table where I have the structure like i've described on the first post.

    The table has one record per year for each employee (then if an employee doesn't change department in the years i've have the same record in the severals years, where the unique difference between the rows is in the start_date and in the end_date.

    Instead, if one employee changes his department in the table i will have 2 records for the year for this employee:

    • in the first record i have the end_date equals to the last day of works in the first department;
    • in the second record i have the start_date equals to the first day of works in the new department

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by acs_one View Post
    I can't revisit the design because I take this datas from an export given by a program not managed by me and where I haven't an access to DB.
    Understood.
    So you are looking for records where the Department is not consistant for all of the records for that employee, right?

  5. #5
    acs_one is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    5
    Nearly.
    I'm searching for employees that in the last two years have changed department.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So there will *only* be possibly two records to deal with right? Does the StartDate of EndDate change?

  7. #7
    acs_one is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    5
    I'm not sure to have understood what did you mean.

    I'm dealing with datas of three years, then i've at least three rows for each employee (unless someone is ceased before 2010 or recruited after 2008).

    About the start_date and the end_date, they can be the same if someone doesn't change department during the year (then the start_date is for example 2008-01-01 and the end_date 2008-12-31) but this doesn't mean nothing because this employee may have changed the department on 2009-01-01.

    I hope that I explained myself well.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You did. I'll give it some thought.

  9. #9
    acs_one is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    5
    Thanks a lot!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Report people grouped to years
    By gerhard_s in forum Reports
    Replies: 3
    Last Post: 10-01-2010, 07:59 AM
  2. Replies: 2
    Last Post: 12-15-2009, 10:41 AM
  3. Query Multiple years
    By sammer021486 in forum Queries
    Replies: 3
    Last Post: 10-21-2009, 02:13 PM
  4. Sigh, having used Access in 5 years and stuck..
    By Access Denied in forum Access
    Replies: 3
    Last Post: 10-06-2009, 02:19 PM
  5. query date that is five years older than today
    By cpsummer in forum Queries
    Replies: 2
    Last Post: 09-26-2007, 02:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums