user1707616
user1707616

Reputation: 117

Why is SELECT MIN(CAST(`field` as SIGNED)) rounding my result value?

When I try to use this query

SELECT MIN(CAST(`field` as SIGNED))

The results end up being rounded. So instead of 7.56 that I should be getting I am getting 7. Any ideas?

Upvotes: 0

Views: 183

Answers (2)

user1707616
user1707616

Reputation: 117

...CAST(value as DECIMAL(10,5))

Upvotes: 0

John Woo
John Woo

Reputation: 263713

because you are using SIGNED, try DECIMAL

SELECT MIN(CAST(`field` as DECIMAL(10,4)))

Upvotes: 2

Related Questions