I am trying to get the last line using groupby, I have a duplicate jobseeker_id, but the difference is call_reason, status, type_of_call etc ... and created_at.
id jobseeker_id type_of_call status call_reason created_at 1 2001 incoming_call good because of track 2017.10.1 2 2001 outgoing call fair they called me 2017.11.2 3 2001 outgoing call bad something 2017.12.3 4 2002 outgoing call good something 2018.11.6
So, I expected to go out only
id jobseeker_id type_of_call status call_reason created_at 1 2001 outgoing call bad something 2017.12.3 4 2002 outgoing call good something 2018.11.6
$jobseekers =DB::table('calllogs') ->select(DB::raw("max(created_at),jobseeker_id,call_reason,type_of_call")) ->orderBy('created_at','desc') ->groupBy('jobseeker_id') ->wherenotnull('call_back_date') ->get();
the above query returns me as
id jobseeker_id type_of_call status call_reason created_at 3 2001 incoming_call good because of track 2017.12.3 4 2002 outgoing call good something 2018.11.6
I can only get the latest created_at date, but I can get the latest staus, type_of_call, call_reason.Can anyone have an idea? please help me.
laravel, , , . max created_at, . .
SELECT * FROM calllogs WHERE id IN ( (SELECT MAX(ID) FROM calllogs GROUP BY jobseeker_id);
, , , 3, 1. , , , . , , , , . .
$jobseekers =DB::table('calllogs') ->select(DB::raw("max(created_at),jobseeker_id,call_reason,type_of_call")) ->orderBy('jobseeker_id','desc') ->wherenotnull('call_back_date') ->take(2) ->get();
Source: https://habr.com/ru/post/1690985/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1690980/how-to-config-several-private-repository-and-public-repository-in-npm&usg=ALkJrhj_lw5epzeF2XVRW_cIPFqFrokPCAAngular 4: Mock ElementRef - angularUsing different compiler flags for C and C ++ files in python extension - c ++Angular2 Inject ElementRef in unit test - dependency-injectionHow to use CAS authentication with angular2 webpack startter typescript? - node.jsGeneric Swift Classes - genericsHow to explicitly provide implicit arguments in Coq? - coqBest way to localize UserControl in C # (winforms) - c #Webpack dev server throws error - refuses to execute the script because its MIME type ('text / html') is not executable - javascriptHow can I use the MongoDB driver with the C # ASP.NET Core API? - c #All Articles