Result Mysql query different localhost and production

Asked

Viewed 94 times

1

I have a problem in which the same query executed on the local server and production, return a different result. The production version is coming incomplete in the EVALUATIONS field. I checked the server and local mysql version and they’re different. Should this problem be happening? Follow the data for analysis:


QUERY

SELECT A.*,
       L.nome AS localidade,
       CA.nome AS cargo,
        (
            SELECT GROUP_CONCAT( CONCAT( AT.id, '=', AT.telefone, ';', AT.observacao ) SEPARATOR '{{separador}}' )
            FROM tal_a_c_alunos_telefones AS AT
            WHERE AT.aluno_id = A.id  
        ) AS telefones,
        (
            SELECT GROUP_CONCAT( T.nome SEPARATOR ', ' )
            FROM tal_a_c_turmas_alunos AS TA
            LEFT JOIN tal_a_c_turmas AS T
            ON TA.turma_id = T.id
            WHERE TA.aluno_id = A.id  
        ) AS turmas,
        (
            SELECT GROUP_CONCAT( C.nome SEPARATOR ', ' )
            FROM tal_a_c_turmas_alunos AS TA
            LEFT JOIN tal_a_c_turmas AS T
            ON TA.turma_id = T.id
            LEFT JOIN tal_a_c_cursos_turmas AS CT
            ON T.id = CT.turma_id
            LEFT JOIN tal_a_c_cursos AS C
            ON CT.curso_id = C.id
            WHERE TA.aluno_id = A.id
        ) AS cursos,
        (
            SELECT GROUP_CONCAT( CONCAT( C1.nome, '{{td}}' , AV.nome, '{{td}}', AV.peso, '{{td}}', AA.nota ) SEPARATOR '{{tr}}' )
            FROM tal_a_c_alunos_avaliacoes AS AA
            LEFT JOIN tal_a_c_avaliacoes AS AV
            ON AA.avaliacao_id = AV.id
            LEFT JOIN tal_a_c_cursos AS C1
            ON AA.curso_id = C1.id
            WHERE AA.aluno_id = A.id
        ) AS avaliacoes,
        (
            SELECT COUNT(*)
            FROM tal_a_c_alunos_avaliacoes AS AA
            LEFT JOIN tal_a_c_avaliacoes AS AV
            ON AA.avaliacao_id = AV.id
            LEFT JOIN tal_a_c_cursos AS C2
            ON AA.curso_id = C2.id
            WHERE AA.aluno_id = A.id
        ) AS avaliacoes_realizadas,
        DATE_FORMAT( A.data_inicio, '%d/%m/%Y' ) AS data_inicio,
        DATE_FORMAT( A.data_conclusao, '%d/%m/%Y' )  AS data_conclusao
FROM tal_a_c_alunos AS A
LEFT JOIN tal_a_c_localidades AS L
    ON A.localidade_id = L.id
LEFT JOIN tal_a_c_cargos AS CA
    ON A.cargo_id = CA.id
ORDER BY A.nome

LOCALHOST

inserir a descrição da imagem aqui

RESULT: Sensitization to Ead{td}}Student role{td}}1{{td}}10{{{tr}}Sensitization to Ead{td}}Virtual call{td}}1{{td}}10{{{tr}}Sensitization to Ead{td}}Group lemma{td}}1{{td}}10{{tr}}Sensitization to Ead{td}}Who are my colleagues? {{td}}1{{td}}10{{tr}}Sensitization for Ead{td}}Poll{{td}}1{{td}}10{{{tr}}Telelists Website{{td}}Creating Domains{td}}1{{td}}6.75{{tr}}Telelistas Site{{td}}Composição Editorial{{td}}2{{td}}8{{{tr}}Telelistas Site{{td}}Avaliação Final{{td}}1{{td}}8{{tr}}Telelistas Site{{td}}Why does a company need a website? {{td}}2{{td}}10{{tr}}Telelists Site{{td}}Why do companies not achieve the expected success on the Internet? {{td}}2{{td}}10

* The bold part is missing in the production result


PRODUCTION

inserir a descrição da imagem aqui

RESULT: Sensitization to Ead{td}}Student role{td}}1{{td}}10{{{tr}}Sensitization to Ead{td}}Virtual call{td}}1{{td}}10{{{tr}}Sensitization to Ead{td}}Group lemma{td}}1{{td}}10{{tr}}Sensitization to Ead{td}}Who are my colleagues? {{td}}1{{td}}10{{tr}}Sensitization for Ead{td}}Poll{{td}}1{{td}}10{{{tr}}Telelists Website

  • 1

    The data may be different. That’s why the Query returned different results?

  • The data is the same. The only difference is in the MYSQL version. I believe it is related to some mysql bug or buffer configuration.

  • 1

    How do you know the data is the same at the base? How you are getting this data for comparison (form in the application, select by command line...)?

  • I imported the production data to the localhost. The data is requested by the system by an ajax request. I’m comparing through the system, console and phpmyadmin. And are returning the same.

  • @Robertopc Through the system, console and phpmyadmin, the data is the same. Ok. And when not? By which comparison method the data do not match?

  • Then the 3 ways are returning the problem. In localhost is coming full field and production is incomplete. The bank is the same and the query tb. The only difference in my view is version, where in production is a little more updated.

  • @Robertopc I was going to suggest looking at the column content size (select LENGTH(AVALIACOES) and select CHAR_LENGTH(AVALIACOES) but I did not find this column in the query. It is the result of that subquery with GROUP_CONCAT? Funny, from the content returned, it doesn’t seem.

Show 2 more comments

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.