vendredi 19 février 2016

How to get the last updated row in a tabel inside a Join query (Laravel 5)

I have query something like this

$deals=DB::table('leadsheet')
            ->join('Deal', 'leadsheet.leadcode', '=', 'Deal.leadcode')
            ->join('vipbooking', function ($join) {
                        $join->on('leadsheet.leadcode', '=', 'vipbooking.leadcode')
                         ->where('id', DB::raw("(select max(`id`) from vipbooking)"));
            })
            ->where('leadsheet.leadcat', '=','Delegates')
            ->get();

I am getting following error

Missing argument 3 for Illuminate\Database\Query\JoinClause::where(),

it is pointing to the following line s

->where('id', DB::raw("(select max(`id`) from vipbooking)"));

I want to get the max ID from vipbooking form.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire