Good day, I'm doing a query in PHP to get the data depending on the date of the records, the detail is that the query does not work, I'm not sure that the syntax of the query in the WHERE part this correct since I use an INNER JOIN to obtain information from two tables, they could indicate me if the query is correct and if not, they could tell me in which part I am wrong. Annex code:
$consulta = "SELECT empleado.nomina, empleado.nombre, empleado.depto, comentarios.comentario, comentarios.fecha FROM empleado WHERE fecha < '$fecha' INNER JOIN comentarios on empleado.nomina=comentarios.nomina";