Each time my user looks up a customer, I store the customer ID, Name and timestamp (timestamp = when the user performed the look up).
Kinda like:
ID Name Timestamp
1 CompanyA 2012-10-01 10:00
2 ComapnyB 2012-10-01 10:11
3 CompanyA 2012-10-01 10:22
4 CompanyA 2012-10-01 10:25
4 CompanyC 2012-10-01 10:32
My question is …
I want to return TOP 30 distinct customers sorted by date descending – how do I do that?
I want to return this:
CompanyC
CompanyA
CompanyB
… only a single instance sorted by the date descending.
1 Answer