I have the following query in mysql:
I'm telling you to select two tables (delays, jobs) and add the hour column.
The problem is that the hour column is also repeated in the jobs table.
$sql = ("SELECT demorat, hora, minuto, refe, reporte, id_trabajo, equipo, flota, SUM(hora) AS hours, SUM(minuto) AS minute
FROM demoras,trabajos WHERE trabajos.reporte_kal BETWEEN '$fecha_md' AND '$fecha_md1'
AND trabajos.refe=demoras.refe group by demoras.demorat");
How could I do so that I only add the hour column of the delay table?
Since it currently tells me that this column is ambiguous, that is, it is repeated in both tables.
Any help you can give me would be very helpful, thank you very much.
In sql you can use an "alias" or use the names of the tables and in this way resolve the ambiguity.
For example:
Both forms are equivalent, and thus you break the ambiguity