Turns out I have 2 tables: Material
andReverse
Material
reverse
I need to obtain EVERYTHING that is in the table Reverse
plus the name of the Material according to the table Material
(that is, I need to obtain A/R FIBERGLASS
andPOLYESTER FELT (12 oz)
I'm using a INNER JOIN
to get this like so:
SELECT rev.id, rev.material, ma.nombreMaterial, rev.aprobado, rev.aros, rev.revision, rev.diametro, rev.largo, rev.top1, rev.bottom, rev.otras, rev.uni_cajas
FROM Reverse rev
INNER JOIN Material ma ON ma.material=rev.material
When I run this it returns the following:
(It is not showing me the record with 4319
), if by chance I add a WHERE like this:
WHERE ma.material='3140'
If it shows me the 3140
but if I change the WHERE
by 4319
, it doesn't show me anything, what is the error that it has?
Try using a LEFT JOIN, so that it shows you all the records that match or not, if you use the inner join it will only show you the records that are the same in the 2 tables