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 19 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 31 Dev Smith admin 123 admin@admin.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 81 k1 v1
2 31 Dev Smith admin 123 admin@admin.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 82 k2 v2
3 31 Dev Smith admin 123 admin@admin.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 83 k3 v3
4 31 Dev Smith admin 123 admin@admin.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 84 k4 v4
5 31 Dev Smith admin 123 admin@admin.com 09977848644 male 2019-03-29 Chess BA Digital Dreams Technology A 106 leeds Enclave CA CA USA 45200 lorep ipisusm 85 k5 v5
6 27 first last user27 123 user27@user27.com 555-555-5555 male 2023-09-01 sadf asdf dfgs sdfa ny ny usa 10018 df 86 My Meta hello
7 27 first last user27 123 user27@user27.com 555-555-5555 male 2023-09-01 sadf asdf dfgs sdfa ny ny usa 10018 df 87 Second Meta how are you
8 27 first last user27 123 user27@user27.com 555-555-5555 male 2023-09-01 sadf asdf dfgs sdfa ny ny usa 10018 df 88 third Meta 3meta v
9 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. 89 Total Experience1 5 years22
10 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. 90 Total Experience2 5 years33
# 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