Skip to content

Instantly share code, notes, and snippets.

@mayroncachina
Created August 26, 2015 18:32
Show Gist options
  • Save mayroncachina/488d7409a3233f2149a3 to your computer and use it in GitHub Desktop.
Save mayroncachina/488d7409a3233f2149a3 to your computer and use it in GitHub Desktop.
SELECT
usuarios.id,
usuarios.nome,
usuarios.email,
usuarios.nascimento,
GROUP_CONCAT(telefones.numero SEPARATOR ', ') AS telefones,
usuarios.cep,
usuarios.estado,
usuarios.cidade,
usuarios.endereco,
usuarios.bairro,
GROUP_CONCAT(area_interesse.nome SEPARATOR ', ') AS 'areas de interesse',
GROUP_CONCAT(formacao_academica.nivel SEPARATOR ', ') AS nivel,
GROUP_CONCAT(formacao_academica.nome_curso SEPARATOR ', ') AS cursos,
GROUP_CONCAT(formacao_academica.instituicao SEPARATOR ', ') AS instituicoes,
GROUP_CONCAT(CONCAT(formacao_academica.periodo_inicial, ' / ',
formacao_academica.periodo_final ) SEPARATOR ', ') AS 'Formação inicio/termino',
GROUP_CONCAT(CONCAT(formacao_academica.nome_curso, ': ',
formacao_academica.descricao ) SEPARATOR ', ') AS descricao,
GROUP_CONCAT(habilidades.nome SEPARATOR ', ') AS 'competencias/habilidades',
GROUP_CONCAT(experiencia.empresa SEPARATOR ', ') AS empresa,
GROUP_CONCAT(experiencia.cargo SEPARATOR ', ') AS cargos,
GROUP_CONCAT(experiencia.cidade SEPARATOR ', ') AS cidade,
GROUP_CONCAT(CONCAT(experiencia.periodo_inicial, ' / ',
experiencia.periodo_final ) SEPARATOR ', ') AS experiencias,
GROUP_CONCAT(CONCAT(experiencia.cargo, ': ',
experiencia.descricao ) SEPARATOR ', ') AS descricao
FROM usuarios
LEFT JOIN telefones ON
usuarios.id = telefones.id_usuario
LEFT JOIN area_interesse ON
usuarios.id = area_interesse.id_usuario
LEFT JOIN formacao_academica ON
usuarios.id = formacao_academica.id_usuario
LEFT JOIN experiencia ON
usuarios.id = experiencia.id_usuario
LEFT JOIN habilidades ON
usuarios.id = habilidades.id_usuario
GROUP BY
usuarios.id,
usuarios.nome,
usuarios.email,
usuarios.cep,
usuarios.estado,
usuarios.cidade,
usuarios.endereco,
usuarios.nascimento
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment