Good day,
Hope you can help me to build this query. I have two tables one is for the tasks and the other one is for trials (see description of tables below). Each employee is allowed to perform more than a trial per each task. In other words, each task could have more than one trial for any employee. What I want to get is the records in the Trials Table based on the latest or maximum Trial Number performed in each task for all the employees (which are lines# 2, 4&5 in the example below).
Example:
Trial ID Task ID Trial Number Employee Badge
1 50 1 277321
2 50 2 277321
3 50 1 280000
4 50 2 270000
5 60 1 277321
Description:
Tasks Table (Parent Table)
1- Task ID (Primary Key)
2- Task Title
Trials Table (Child Table)
1- Trial ID (Primary Key)
2- Task ID (Foreign Key)
3- Trial Number (this reflects how many times the task has been performed)
4- Employee Badge
Thanks in advance
Hope you can help me to build this query. I have two tables one is for the tasks and the other one is for trials (see description of tables below). Each employee is allowed to perform more than a trial per each task. In other words, each task could have more than one trial for any employee. What I want to get is the records in the Trials Table based on the latest or maximum Trial Number performed in each task for all the employees (which are lines# 2, 4&5 in the example below).
Example:
Trial ID Task ID Trial Number Employee Badge
1 50 1 277321
2 50 2 277321
3 50 1 280000
4 50 2 270000
5 60 1 277321
Description:
Tasks Table (Parent Table)
1- Task ID (Primary Key)
2- Task Title
Trials Table (Child Table)
1- Trial ID (Primary Key)
2- Task ID (Foreign Key)
3- Trial Number (this reflects how many times the task has been performed)
4- Employee Badge
Thanks in advance
Comment