In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In the Java project, if you query some fields of a table in the database through Mybatis, the return value is list. Sometimes the [null, null] phenomenon occurs.
The specific reason is that the query SQL only fetches some fields, and these fields are null.
But for other fields of the database table, the query has a value, but it just so happens that the field you query is Null.
Execute: SELECT * FROM user2 WHERE name='rtr'
The result is:
A rtr 2019-02-19
B rtr 2019-02-19
Execute: SELECT department_id FROM user2 WHERE name='rtr'
The result is:
Null
Null
Execute: SELECT COUNT (*) FROM
(SELECT department_id FROM user2 WHERE name='rtr') AS t
The result is: 2.
Solution: several fields that need to be queried must be added with a judgment that is not empty.
SELECT department_id FROM user2 WHERE NAME = 'rtr' AND department_id IS NOT NULL
Results: null
SELECT
COUNT ()
FROM
(SELECT FROM user2 WHERE NAME = 'rtr' AND department_id IS NOT NULL) AS t
Result: 0
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.