Do not throw me the expected result when I use the inner join

-1

the first code brings me the result well

select  t.TransaccionId, t.NetAmount, t.UserId, t.Id_movimiento, t.CreatedDate
from TablaPrincipal t where id_movimiento is null

the second code

select  t.TransaccionId, t.NetAmount, t.UserId, t.Id_movimiento, t.CreatedDate, u.nombreApellido_usuario
from TablaPrincipal t
inner join Usuarios u on t.UserId = u.Id_usuario
where id_movimiento is null

but when I put the inner join it does not bring me anything! Any ideas?

    
asked by Dieguito Weed 06.11.2018 в 21:49
source

1 answer

0

Try using Left Join .

Example:

select  t.TransaccionId, t.NetAmount, t.UserId, t.Id_movimiento, t.CreatedDate, u.nombreApellido_usuario
from TablaPrincipal t
Left join Usuarios u on t.UserId = u.Id_usuario
where id_movimiento is null

Verify that the relationship you are doing in the tables is well done and based on your keys.

    
answered by 06.11.2018 / 23:54
source