Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

how to select the latest added/edited comments

edited May 2008 in Vanilla 1.0 Help
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



  • Options
    well, i think i managed to work, if anyone is interested in the solution: (assuming 'c' is the alias of the comment table)
    $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`
This discussion has been closed.