I don´t have a field as such, but I am making a new field which is the result dividing an existing开发者_如何转开发 field, i.e. cost/1.15
Is there a way to restrict the result of this calculation to two decimal places?
You could change the column type to a NUMERIC(p, 2)
where p is the precision, especially if it is money (I'm guessing from cost
that it might be money).
Also making a column which is derived from another column is generally a bad idea as the two can get out of sync. Consider making a view instead.
Sounds like you need the ROUND()
function.
Eg. ROUND(cost/1.15, 2)
精彩评论