how to select the latest added/edited comments
i need help with selecting the latest comments from the database:
i want them ordered from newest to oldest but also taking into account the 'DateEdited' field, not only the 'DateCreated'.
if it's possible, i'd like to do it with the SQLBuilder, but it's not a must, i prefer it working :P
thanks
i want them ordered from newest to oldest but also taking into account the 'DateEdited' field, not only the 'DateCreated'.
if it's possible, i'd like to do it with the SQLBuilder, but it's not a must, i prefer it working :P
thanks
0
This discussion has been closed.
Comments
$Sql->AddSelect('DateEdited','c','lastdate','IFNULL','c.DateCreated'); ... $Sql->AddOrderBy(array('lastdate'),array(''),'desc');
which produces something like:
IFNULL(`c.DateEdited`,`c.DateCreated`) as `lastdate`