Reputation: 133
Joining two tables showing error:
"SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'transaction_master ' "
But in my database transaction_master
is exists.
The following query:
$trans_results= DB::table('report_master as rm')->join('transaction_master ', 'transaction_master.id','=','rm.id')->select('transaction_master.name as transactionID')->get();
Upvotes: 1
Views: 309
Reputation: 38652
try this
DB::table('report_master')
->join('transaction_master', 'report_master.id', '=', 'transaction_master.id')
->select('transaction_master.name as transactionID')
->get();
Read - Laravel Query Builder Joins
Upvotes: 2
Reputation: 926
You need to reverse the transaction_master.id
and the rm.id
in your join
Upvotes: 0