php - How to select rows from two tables in laravel and return them as a single list -
i have 2 tables,one called patient_payments , other patient_billing.i want select rows each table , present them single list in webpage.i using laravel framework , have used raw query follows
$items = db::select(db::raw('select * patient_payments pp,patient_billings pb')); one table has 3 rows , other 5 rows , expecting 2 8 rows query returns 14 rows wrong.any idea wrong query appreciated.
thanks in advance
if both tables have same number of columns, can use union() method this:
$items = db::table('patient_payments') ->union(db::table('patient_billings')) ->get(); read more laravel query builder: union() here.
hope help.
Comments
Post a Comment