SQL query with multiple database and different tables in Laravel

DB::select("SELECT db1.employees.name AS employee_name, db2.companies.name as company_name

FROM db1.employees employees

JOIN db2.companies companies ON companies.code = employees.company_code

WHERE companies.country = 'Bangladesh' ");

Note: Both database users and passwords have to be the same.

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine