jeudi 30 juillet 2015

multiple SUM from multiple tables to one query

SELECT amount, SUM(amount) AS intotal FROM incomes

intotal = 500

SELECT amount, SUM(amount) AS outtotal FROM outgo

outtotal=300

and after that but totals together total=intotal-outtotal= 200




Aucun commentaire:

Enregistrer un commentaire