Skip to content
Advertisement

Find sum() from two different tables and join them based on a condition?

I have two tables,

Table1:

Table2

I want to sum the Amount column of table1 and sum the settled_amount column of Table2 of a particular ID group by the Date column.

So My result would be for ID=123:

Advertisement

Answer

You can use union all and group by. For all ids:

You can filter for a particular id using a where clause in the outer query.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement