C
clifgriffin
I need some SQL advice...
I'm writing an application that will track passwords for the
organization I work with. It uses a field HistoryID as an ID for the
password. And generation, as a way to track old passwords. Each time a
password is updated, the generation is incremented by 1. The HistoryID
with the highest Generation is the current password for a given
generation.
The table looks like so...
Username Password HistoryID Generation
clifton Something 12 0
clifton Something1 12 1
steven Yours 10 8
steven Yours2 10 9
I want to do a query that pulls all historyIDs, but only the ones with
the highest generation... So the query would return...
Username Password HistoryID Generation
clifton Something1 12 1
steven Yours2 10 9
How do I do this? I can't think through the logic in order to write
the query or subquery... I can get the record with the highest
generation for a given historyID, but not a set of all of them.
Any ideas?
I'm writing an application that will track passwords for the
organization I work with. It uses a field HistoryID as an ID for the
password. And generation, as a way to track old passwords. Each time a
password is updated, the generation is incremented by 1. The HistoryID
with the highest Generation is the current password for a given
generation.
The table looks like so...
Username Password HistoryID Generation
clifton Something 12 0
clifton Something1 12 1
steven Yours 10 8
steven Yours2 10 9
I want to do a query that pulls all historyIDs, but only the ones with
the highest generation... So the query would return...
Username Password HistoryID Generation
clifton Something1 12 1
steven Yours2 10 9
How do I do this? I can't think through the logic in order to write
the query or subquery... I can get the record with the highest
generation for a given historyID, but not a set of all of them.
Any ideas?