MySQL multiple JOINs with Aggregate functions

In this tutorial we are going to learn about MySQL multiple JOINs with Aggregate functions. Lets see how to implement it.

Suppose we have multiple tables and we want sum of a column from each table. Then we can use the following methods.

Lets create and insert data inĀ  Item table

Create and insert data in SoldItems

Create and insert into

 

The final Query to get aggregate of each table column is as follow:

O/P:

 

We can write the query in another way by writing sub query in select clause:

O/P

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *