Try this:
$applicantIds = \DB::select()->from( 'applicants' )->where( 'created_at', 0 )->execute();
$applicantApps = \DB::select( 'applicant_id', 'created_at' )->from( 'applicant_apps' )->where( 'applicant_id', 'in', $applicantIds)->execute();
$statement = '';
foreach ($applicantApps as $applicantApp)
{
$applicantId = $applicantApp['applicant_id'];
$applicantCreatedAt = $applicantApp['created_at'];
$statement .= "update applicants set created_at='$applicantCreatedAt' where id = '$applicantId';"
}
if ($statement) {
\DB::query($statement)->execute();
}
Two queries only will get you this.
* Be the first to Make Comment