Don't you just need to group on expirationtime?
Something like
select expirationtime, count(expirationtime)
from messages
group by expirationtime;
This will give you a list of the distinct expirationtime and the amount of times they occur.
Of course you'd have to replace the expirationtime in the above statement with your calculation of how it's derived from the database.
Nige
Nige Ridd
Junior Poster in Training
52 posts since Nov 2007
Reputation Points: 13
Solved Threads: 9