Method in mysql where the sum float type USES a decimal point
- 2020-06-03 08:34:13
- OfStack
Approach 1: the best approach is to change the float field to decimal(16,6). Specific method: One temporary field can be set, and binary keyword can be combined to copy accurately, etc.
Approach 2: Use the binary keyword. "select sum(binary field name (float type))"
BINARY is not a function but a cast operator that forces the string following it to be a binary string
Example:
Approach 2: Use the binary keyword. "select sum(binary field name (float type))"
BINARY is not a function but a cast operator that forces the string following it to be a binary string
Example:
"select sum(a.number*binary(b.price)) as total
from ler_card as a
left join ler_items as b on a.itemId=b.itemId
where user_id=1"