PDOCrud Inner Join between tables

SQL INNER JOIN returns all rows from tables where the key record of one table is equal to the key records of another table. You can easily perform the INNER JOIN operation using pdcrud, all you need to do is specify the join table name and the join condition between two tables. Below examples shows inner join between user table and usermeta table that has matching column 'user_id'. It will select all records having matching user_id from both of these tables. During select/insert/update operation, data from both tables will be shown for inner join operation.

  
                            $pdocrud = new PDOCrud();
                            /**
                            * Add join between tables, supported join condition are "INNER JOIN" & "LEFT JOIN"
                            * @param   string  $joinTableName                             name of table to be joined
                            * @param   string  $joinCondition                             join condition e.g. ("table2.col = table1.col")
                            * @param   string  $joinType                                  type of join (Inner or left join)-default is inner join
                            * return   object                                             Object of class
                            */
                            $pdocrud->joinTable("user_meta", "user_meta.user_id = users.user_id", "INNER JOIN");
                            echo $pdocrud->dbTable("users")->render();
                        

Users

Showing 1 to 10 of 11 entries

# User id First name Last name User name Password Email Phone Gender Birth date Hobbies Educational status Company name Address City State Country Zip code About yourself User meta id Meta key Meta value Actions
1 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 64 Total Experience7 5 years22
2 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 65 Total Experience7 5 years22
3 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 66 Total Experience7 5 years22
4 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 67 Total Experience7 5 years22
5 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 68 Total Experience7 5 years22
6 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 69 Total Experience7 5 years22
7 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 70 Total Experience7 5 years22
8 26 Jon Snow jon jonathaon jon@gmail.com 99009900 male 2016-11-11 Footbal, volleyball, dddd BE DDT USA newyork 0 3 452005 about desc. 71 Total Experience7 5 years22
9 31 Dev Smith admin admin_ddt@123 dev.ddtech@gmail.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 74 k1 v1
10 31 Dev Smith admin admin_ddt@123 dev.ddtech@gmail.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 75 k2 v2
# User id First name Last name User name Password Email Phone Gender Birth date Hobbies Educational status Company name Address City State Country Zip code About yourself User meta id Meta key Meta value Actions