Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthormiquel
    • CommentTimeMay 16th 2008
     # 1
    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
    • CommentAuthormiquel
    • CommentTimeMay 18th 2008
     # 2
    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`
Add your comments
    Username Password
  • Format comments as