PHP SQL INNER JOIN Query on Multiple Tables
Today, We want to share with you PHP SQL INNER JOIN Query on Multiple Tables.
In this post we will show you SQL INNER JOIN Multiple Tables example, hear for PHP SQL INNER JOIN query on multiple tables we will give you demo and example for implement.
In this post, we will learn about SQL join three or more tables with an example.
Syntax of INNER JOIN Multiple in MYSQL
select * from tableA a inner join tableB b on a.common = b.common inner join TableC c on b.common = c.common
Example 1 : SQL INNER JOIN Multiple Tables example
SELECT p.pagename , p.pageid , p.pagedesc , p.pagetitle , u.username , u.useremail FROM pages p INNER JOIN cart ct on p.pageid = ct.pageid INNER JOIN users u on ct.userid = u.useridExample 2 : Joining Three or More Tablestable1 = users table2 = pages table3 = product primaryKey = userid SELECT * FROM users INNER JOIN pages ON users.userid=pages.table1Id INNER JOIN product ON users.userid=product.table1IdExample 3 : JOIN three tables
SELECT A.* FROM TableA A LEFT OUTER JOIN TableB B ON (A.id = B.a_id) LEFT OUTER JOIN TableC C ON (A.id = C.a_id) WHERE B.a_id IS NOT NULL OR c.a_id IS NOT NULLExample 4 : Simple Example of SQL INNER JOIN
SELECT u.userid, u.usernm, ut.crdr, a.advertnm, a.advertlogo FROM usermst u INNER JOIN usertransactions ut ON u.userid = ut.userid INNER JOIN adverts a ON a.advertsid = ut.advertsid where ut.usertransid=98566