I'm pulling data from a database and one of the tables contain two columns that together identify a location and another column containing a date of each time it was serviced. Is it possible to write a SQL query such that I get the most recent time that each location was serviced?
So if my raw data looks like this:
category_a category_b date
1 a 1/1/01
1 a 2/2/02
1 b 1/2/01
1 b 2/3/02
2 a 1/3/01
2 a 2/4/02
2 b 1/4/01
2 b 2/5/02
then the query would return this:
category_a category_b date
1 a 2/2/02
1 b 2/3/02
2 a 2/4/02
2 b 2/5/02
This would be easy to do if the database was authored in such a way that the category combinations were stored in a separate table. However, I don't control this database, so I can't make changes to it.