The table has a lot of data, but a few are strange, the field is float type, 2 values are the same
Payment value =299.7
Feiyong value =299.7
Query statement: feiyong>0 and Payment>0 and Payment
At this point can still query out, and just a few have this problem, the others are normal
Reply to discussion (solution)
Floating-point numbers represent a large number, missing part of the precision
So apply when comparing: a strategy that is equal when the absolute value of the difference of two numbers is less than a certain minimum number
Or use round to obtain a valid number after comparing
If your application needs to have a precise number of decimal digits (such as finance) then you should use the DECIMAL type
This is still quite normal. After all, float data has no way of guaranteeing the accuracy of the data.
Floating-point numbers represent a large number, missing part of the precision
So apply when comparing: a strategy that is equal when the absolute value of the difference of two numbers is less than a certain minimum number
Or use round to obtain a valid number after comparing
If your application needs to have a precise number of decimal digits (such as finance) then you should use the DECIMAL type
Now how to change the query statement to normal query, thank you
Suggested modification type is decimal
Select ..., ABS (Payment-feiyong) as aform ... where feiyong>0 and payment>0having a > 1e-5
Select ..., (payment-feiyong) as aform ... where feiyong>0 and payment>0having a > 1e-5