Así queda el código, ya funciona perfectamente!
Código PHP:
Ver original$trabajos = DB::table('trabajos')
->join('tecnicos', 'trabajos.responsable_diagnostico', '=', 'tecnicos.id') ->where('trabajos.created_at', '>=', $desde4)
->where('trabajos.created_at', '<=', $hasta4)
->select(DB::raw("tecnicos.nombre,
SUM(if(TIMEDIFF(STR_TO_DATE(CONCAT('trabajos.fecha_diag', ' ', 'trabajos.hora_diag'), '%d/%m/%Y %H:%i'),
STR_TO_DATE(CONCAT('trabajos.fecha_ingreso', ' ', 'trabajos.hora_ingreso'), '%d/%m/%Y %H:%i'))<'00:30:00',1,0)) as bien,
SUM(if(TIMEDIFF(STR_TO_DATE(CONCAT('trabajos.fecha_diag', ' ', 'trabajos.hora_diag'), '%d/%m/%Y %H:%i'),
STR_TO_DATE(CONCAT('trabajos.fecha_ingreso', ' ', 'trabajos.hora_ingreso'), '%d/%m/%Y %H:%i'))<'00:30:00',0,1)) as mal"))
->groupBy('tecnicos.nombre')
->get();
Muchas gracias NSD y Quimfv por su tiempo, han sido de mucha ayuda!
Saludos!