obamaself Posted May 11, 2012 at 03:33 PM Report #454635 Posted May 11, 2012 at 03:33 PM Boas, tenho 3 tabelas ( trabalhadores, carros, carros_trabalhadores) quero seleccionar os trabalhadores que têm carros, mas aparecem-me registos repetidos, ou seja, se um trabalhador tiver 3 carros aparecem me 3 registos com esse trabalhador. Qwery: SELECT trabalhadores . * , viaturas.num_carro, viaturas.matricula FROM trabalhadores, carros_trabalhadores, viaturas WHERE trabalhadores.num_trabalhador = carros_trabalhadores.num_trabalhador AND viaturas.num_carro = carros_trabalhadores.num_carro Há alguma maneira no mysql de não repetir o codigo do trabalhador ou assim?
AndreLC Posted May 11, 2012 at 03:44 PM Report #454647 Posted May 11, 2012 at 03:44 PM Com a Cláusula GROUP BY. echo ($knowledge != $sharing) ? "Serves no purpose!" : "Thank you for your help. It was very precious.";
obamaself Posted May 11, 2012 at 03:46 PM Author Report #454650 Posted May 11, 2012 at 03:46 PM Ja esta obrigada. B)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now