I need to make a query to update a data from the relation of two tables, where if the given date (variable $fecha_actualizar
) is the same for perfiles_evento
and to check, update the stage in which it is to 4, I think the query is fine, but also if in perfiles_evento.fecha
is null, I should buy if evento.asistencia = 1;
I tried to do in 2 separate querys but executed in the same controller:
$query = DB::table('perfiles_evento')
->where('perfiles_evento.evento_id', $evento_id)
->where('perfiles_evento.fecha',$fecha_actualizar)
->join('check','perfiles_evento.evento_id','check.evento_id')
->where('checkins.fecha',$feha_actualizar)
->update(['perfiles_evento.stage' => 4]);
here is the first, the second is:
$query = DB::table('perfiles_evento')
->where('perfiles_evento.evento_id', $evento_id)
->where('perfiles_evento.fecha',NULL)
->join('check','perfiles_evento.evento_id','check.evento_id')
->where('checkins.asistencia',1)
->update(['perfiles_evento.stage' => 4]);
The problem is that when executing
select fecha from perfiles_evento where perfiles_evento.fecha = NULL;
in the mysql console, it brings me an empty table, but there are empty dates. so I do not know if the query is working correctly when executing it in the controller in laravel. Both values are "date" type.