-3
I have these 3 tables:
I want to mount a SELECT that counts the number of records for each of them.
SELECT
COUNT(client.idClient) AS clientQuantity,
COUNT(clientVehicle.idClientVehicle) AS clientVehicle,
COUNT(parking.idParking) AS parkingQuantity
FROM
client,
clientVehicle,
parking
WHERE
client.idClient AND
clientVehicle.idClientVehicle AND
parking.idParking
However, the result is 4 for all, and it should be, parkingQuantity 1, clientQuantity2 and clientVehicles 2. Where I’m wrong?
Thank you very much.
Remove the clause
WHERE
– Augusto Vasques
no Join there, you added 4 tables in
FROM
and does not link them, will return a cartesiado of all, and everything will have the same value!– Ricardo Pontual