我有一个创建报告的查询。该报告很好,但这些值都有我不想看到的小数。谁能帮我吗?
查询如下:
SELECT A.ItemCode, B.ItemName, A.OnHand, a.WhsCode , a.MinOrder*b.NumInBuy as 'Minimum Voorraad'
FROM OITW A WITH (NOLOCK)
LEFT OUTER JOIN OITM B WITH (NOLOCK) ON A.ItemCode = B.ItemCode
where b.ItemCode like '1%' AND B.FrozenFor = 'N' And A.WhsCode ='KTC DV' and ItmsGrpCod='112'
and (a.MinOrder*b.NumInBuy) >= a.OnHand and a.MinOrder >0
我得到的报告是这样的:
现在我该如何删除小数? 例如5.000000必须为5,而5.00000000000必须为5。
谢谢。
答案 0 :(得分:0)
使用cast
select cast(235.415 as integer)
它将返回235
所以在你的情况下
SELECT A.ItemCode, B.ItemName, cast(A.OnHand as integer), a.WhsCode ,
cast( a.MinOrder*b.NumInBuy as integer) as 'Minimum Voorraad'
FROM OITW A WITH (NOLOCK)
LEFT OUTER JOIN OITM B WITH (NOLOCK) ON A.ItemCode = B.ItemCode
where b.ItemCode like '1%' AND B.FrozenFor = 'N' And A.WhsCode ='KTC DV' and ItmsGrpCod='112'
and (a.MinOrder*b.NumInBuy) >= a.OnHand and a.MinOrder >0