嗨,我坚持这个问题
SELECT c1.ID
FROM cliente JOIN corsa AS c1 ON corsa.cliente_ID = cliente.ID_cliente,
cliente JOIN corsa AS c2 ON corsa.cliente_ID = cliente.ID_cliente
WHERE c1.tariffa = c2.tariffa AND c2.ID_cliente = 1 AND c2.data_corsa = "2012-06-20";
我收到错误1066而不是唯一的表/别名:'cliente'。 我理解在FROM语句中存在一个问题,我称之为'cliente'两次。我无法弄清楚如何让它发挥作用。
我试过这个
SELECT DISTINCT c1.*
FROM cliente INNER JOIN corsa AS c1,
cliente c2 INNER JOIN corsa AS c3
WHERE c1.tariffa = c3.tariffa AND c3.cliente_ID = 1 AND c3.data_corsa = "2012-06-20";
由于