I\'m using Microsoft SQL. I have a table that contains information stored by two different categories and a date. For example:
ID Cat1 Cat2 Date/Time
Have a look at row_number() on MSDN.
SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY col1, col2 ORDER BY date_time, id) rn FROM mytable ) q WHERE rn = 1
(run the code on SQL Fiddle)