嗨我被困在这个查询上
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 not unique table/alias: '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";
它似乎有效,但我不太确定。
谢谢