Sometimes you need to get records from more than two tables.This can be very confusing when you are not know about mysql JOIN. If you will use multiple queries or sub queries ,it will puts major load on the server.MySql has JOIN Terminology to get records from multiple tables based on conditions, with help of join we will get records in single SQL Query without extra load on server.
The Tutorial illustrate an example from ‘Mysql Join 3 Tables’ using Left Join.’ The LEFT JOIN get all records from left table with matching all records right table’.
Example:
Select App.ApplicationId, App.Name, App.ClientAssociationId, App.Category, App.Status, AK.ClientId from Application as App LEFT JOIN ClientAssociation as Ak ON AK.ClientAssociationId = App.ClientAssociationId
LEFT JOIN Client as C ON C.ClientId = AK.ClientId
In Above query we are fetching all records from application tables based on ClientAssociationId(Foreign Key) of ClientAssociation and ClientId(Foreign Key) of Client.