sql null values will also be filtered when using not equals condition

Today, we are dealing with a query bug, and by screening the error, we locate it on a statement with an "not equal to" condition, as follows

and ic.alarmClass <> ?

 

Both <> and != are used for "not equal" conditions, but at the same time, the data with empty alarmClass is filtered. If you want to keep these data, hql is written as follows:

and ( ic.alarmClass <> ? or ic.alarmClass is null )

 

 

 

What better way to write it? please tell me

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326677296&siteId=291194637