Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

PHP MYSQL SUM total, mas mostra linhas


Tente este 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