Left Join does not return null values in PHPmyAdmin

0

Hi, I'm trying to make this query:

SELECT 
    consulta.id_consulta,actu_consulta.fecha_actu 
FROM 
    consulta LEFT JOIN actu_consulta
       ON consulta.id_consulta=actu_consulta.id_consulta_actu 

And the funny thing is that this query in the workbench returns all the values. And if I try it in the phpmyadmin it returns only the values in which the fecha_actu is not null .

I would like to know what the problem is that is happening to me. Thanks

TABLES:

 create table consulta
(id_consulta int not null auto_increment primary key,
codigo_web long,
usuario_creado int not null,
usuario_cerrado int,
fecha_creacion datetime,
fecha_cierre datetime,
estado_consulta boolean DEFAULT '0',
nombre varchar(15),
email varchar(50),
telf varchar(9),
localidad varchar(25),
idioma varchar(10),
descripcion text,
solucion text,  
capacidad_aula int,
dia_alquiler varchar(10),
tipo_contacto varchar(10),
tipo_consulta  varchar(10),
curso varchar(50),
cp varchar(10));

create table actu_consulta
(id_consulta_actu int not null auto_increment primary key,
id_usuario_actu int not null,
fecha_actu datetime,
descripcion text,
id_consulta int not null,
constraint fk_consulta_actu_consulta foreign key(id_consulta) references  consulta(id_consulta));
    
asked by Seyker 14.02.2017 в 12:42
source

1 answer

1

I think the problem is in the last line of your SQL, because you are related the ids of your 1st table with the primary key of the 2nd one:

       ON consulta.id_consulta=actu_consulta.id_consulta_actu 

The key that should refer to your queries in the second table should not be id_consulta ?

Therefore, the final part should look like this:

   ON consulta.id_consulta=actu_consulta.id_consulta 
    
answered by 14.02.2017 / 14:25
source