简体   繁体   中英

Why would MySQL return NULL yet there is a value in the field?

I am running a join on 3 large tables (over a hundred thousand rows each). The query returns 4 rows as expected, but one of the rows has a "NULL" value, yet in the table is a value I expect to see. I am sure the value is in the db because I can see it in the table, but for some reason, MySQL is returning everything except that particular value. I am not getting any errors. The query runs exactly as expected, except for this null value. See the screenshot below:

在此处输入图片说明

My Question is why would this happen? Has anybody experienced this? Could it be a bug in phpmyadmin? This query is supposed to be a report of some transactions, so you can imagine how funny the report is looking with a blank field that cannot be explained!

have you tried doing it with the inner join (clasic one) , when you do a left join it brings all rows from the left table and those who did not match have null values.

here they explain it better and you can see examples

https://www.w3schools.com/sql/sql_join.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM