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 3 of 3 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 62 fgfdg fdgd gdg fdgd gfdgdgdg@dsadas.com 484 da 2023-04-05 wsd asd asddsa asds adsa sad dsad dsads dsa 88 adsa dsada
2 63 b b b b b@gmail.com b b 2023-04-18 b b b b b b b b b 89 b b
3 73 cyril slucki cyril cyril cslucki@gmail.com 0637931282 male 2023-05-20 wind bac CYBERWORKERS 31b rue espérandieu Marseille us France 13001 a propos 90 meta key meta value
# 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