lundi 28 août 2017

Get count of not matching records mysql laravel

I am trying to get the count of the not matching records from two tables.

One table has records with leading 0(i.e 0199) and other have the integer values.(i.e 199)

DB::table('booking')
    ->whereRaw('booking_pdf.bid != booking.id')
    ->leftjoin('booking_pdf', 'booking.id', '=', 'booking_pdf.bid')
    ->count();

But didn't get the result. Also tried like this,

$bookList = DB::table('booking_pdf')->groupBy('bid')->pluck('bid');
DB::table('booking')
    ->whereNotIn('id', $bookList)
    ->count();

But because of leading 0 records, I'm not getting the proper count.

Where am I wrong?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iAX1k9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire