Mysql
 sql >> Base de données >  >> RDS >> Mysql

PHP MYSQL SUM total mais affiche les lignes

Essayez ce SQL

SELECT * FROM
(
    SELECT *, @total:= @total+ `companyearned` AS `total`
    FROM `recordedhours`, (SELECT @total:=0) r WHERE `group` = '$uid'
    ORDER BY `unixdate` ASC, `idnum` DESC
    LIMIT $from, $max_results
) tab ORDER BY `unixdate` DESC