0
I have a problem when I make one SELECT
in my comic book, I’m using GROUP_CONCAT
to concatenate the column of phones and email but I’m picking up repeated data.
Here is the SELECT
:
SELECT contatos.cont_id
, contatos.cont_firstname
, contatos.cont_lastname
, contatos.data_nasc
, contatos.anotacoes
, GROUP_CONCAT(contatos_email.email)
, contatos_telefone.telefone
, contato_endereco.rua
, contato_endereco.numero
, contato_endereco.bairro
, contato_endereco.cidade
, contato_endereco.estado
, contato_endereco.pais
FROM contatos
JOIN contatos_email ON contatos.cont_id = contatos_email.contato_id
JOIN contatos_telefone ON contatos.cont_id = contatos_email.contato_id
JOIN contato_endereco ON contatos.cont_id = contato_endereco.contato_id
in the column where the emails are being displayed was to appear only 3 emails and not keep repeating like this now...
Friend, add an example of how the data is currently being returned and how you want it to be the final result. It will facilitate the understanding of your question.
– Emerson JS
You are using
GROUP_CONCAT
without doingGROUP
or any aggregation function. What you want to happen?– Bacco
ready I edited the question... Now I think you can understand better :)
– Lázaro Dutra
Tried to
GROUP_CONCAT( DISTINCT contatos_email.email )
? What is the DB server you are using?– Bacco
I’m using maria db in phpmyadmin
– Lázaro Dutra
@Bacco worked I did as you said put the GROUP_CONCAT( DISTINCT contacts_email.email) and worked Vlw :)
– Lázaro Dutra
Good that solved. As you have posted the solution, mark as solved in the green V side of your reply, for the post to be complete.
– Bacco