MYSQL: Include data that is not the same in both tables

0

I have 3 tables where the first is of notes that users are registering

and the other one is from registered companies and the last of registered users by companies

My intention is for the query to obtain the data from the user tables (company and users) with the ids of the first table NOTES. This is my query:

SELECT notas.*, 

        empresa_usuarios_data.nombres_us, 
        empresa_usuarios_data.apellidos_us,

        empresa_data.avatar AS avatarEmpresa, 
        empresa_usuarios_data.avatar AS avatarUsuarios

        FROM notas 

        INNER JOIN empresa_usuarios_data ON empresa_usuarios_data.id_user = notas.id_user
        INNER JOIN empresa_data ON empresa_data.id_empresa = empresa_usuarios_data.id_empresa

        WHERE notas.id_empresa = 3

But the problem as you see is that the column id_user of the first table Notes, there are records with the number 0 that are the companies, but this 0 is not registered in any of the two tables.

and for this reason does not return these records with the number 0 , and I want to obtain them. How could I change my query to include these records with the number 0

    
asked by Arellano Cornejo Daniel 26.12.2018 в 04:36
source

1 answer

0

I do not see in the user table a user with id 0, so I would not do the relation as is the case of the other 49,50,51 ... Try adding a record with id 0 in the users and make the query again , you may be doing well but that user registered in your BD is missing.

You tell me how it went, greetings.

    
answered by 26.12.2018 в 04:42