SQL - Please Help - How can I select values from different rows depending on the most recent entry
Posted
by user321185
on Stack Overflow
See other posts from Stack Overflow
or by user321185
Published on 2010-04-20T10:41:42Z
Indexed on
2010/04/20
10:43 UTC
Read the original article
Hit count: 168
Hiya,
Basically I have a table which is used to hold employee work wear details. It is formed of the columns: EmployeeID, CostCentre, AssociateLevel, IssueDate, TrouserSize, TrouserLength, TopSize & ShoeSize.
An employee can be assigned a pair of trousers, a top and shoes at the same time or only one or two pieces of clothing. As we all know sepeoples sizes and employee levels can change which is why I need help really. I need to be able to select the most recent clothes size and associate level for each item of clothing for each employee.
So for example if employee '54664LSS' was given a pair of 'XL' trousers and a 'L' top on 24/03/11 but then received a 'M' top on 26/05/10. Then the values of the 'M' sized top and the 'L' sized trousers would need to be returned.
Any help would be greatly appreciated as I'm pretty stuck :(. Thanks.
© Stack Overflow or respective owner