Hello,
I have a question regarding an TSQL- Statement I want to build.
Table Structure:
Head- Table
Personalnumber (PK)
DriveNumber (PK)
LicenseNumber
Detail-Table
Personalnumber (PK)
DriveNumber (PK)
PosNumber (PK)
Kilometers
I just want to get the highest DriveNumber in the HeadTable including the personal number.
If I use following statement:
SELECTMAX(DriveNumber ), LicenseNumber
FROMHeadTable
GROUPBYLicenseNumber
I get all LicenseNumbers at all.
But if I add the personalNumber in the Select, I get (of course) all max(driveNumber) for each personalNumber.
How can I solve this one?
Thank you in advance