derby search by join date


I must select the names of the clients whose service was made on 2012-07-15

SELECT nombre FROM Clientes c JOIN Servicios s WHERE s.Fecha = '2012-07-15';

but I get an error


[Exception, Error code 30,000, SQLState 42X01] Syntax error: Encountered "WHERE" at line 1, column 48.

asked by ives rodriguez 31.10.2017 в 20:41

1 answer


You lack the join condition using the ON clause. I do not have the details of your columns, but you may have a ClientId column in both tables, or something like that. In that case, the query would be something like:

select nombre
  from Clientes c
  join Servicios s
    on s.ClientId = c.ClientId -- te falta esto
 where s,Fecha = '2012-07-15';
answered by 31.10.2017 в 21:06