Thanks for moving the post
Yeah, I was using TIMEDIFF()
changed it to:
(UNIX_TIMESTAMP(m.datetime)-UNIX_TIMESTAMP(h.datetime)) AS timediff,
and gives much nicer output, thanks.
Basically this is for a heklp ticket system - the lastview or h.datetime, is the lsat time that the user viewed the ticket, hence it can be NULL, the m.datetime or lastpost value os the last time a message was posted into the ticket (much the same as threads in a forum), I want to be able to ORDER BY a: tickets with new posts since last view ordered by last post date, b: all other tickets ordered by last post date.
So I would like a boolean field, for
if lastview < last post bool = true
else bool = false
So I can ORDER BY bool, lastpost