select distinct .... order by ...

wxdqz

New Member
hello

i'm stuck with a problem in my sql query...

the table layout is something like this:

- email
- timestamp
- message


now to make sure, a user doesn't received the email twice, i thought of the following:

first of all, select distinct message and order it by timestamp, then select distinct email et voila, an user won't receive an email twice. if it was that easy :<

if i add the 'order by timestamp asc', it fetches duplicated messages, since the timestamp is different. i guess this should be possible through SQL without having to "unique" the returned array of the SQL query.... btw, i'm using mysql.

any help/advice/pointers to ressources would be greatly appreciated!

thanks in advance

emanuel
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
 
Back
Top