cancel
Showing results for 
Search instead for 
Did you mean: 

Whole Numbers in SQL Queiries

Former Member
0 Kudos

I have produced the query below so that it will alert our purchaser when he needs to chase up undelivered goods inwards. I want the qty only to display as a whole number rather than having 3 decimal places after it, i am sure there is way of doing this just not sure how to

SELECT T0.[DocNum] AS Doc, T0.[CardName]AS Supplier, T1.[LineNum] AS Row, T1.[ItemCode] AS Code, T1.[Dscription] As Desciption, T1.[Quantity] AS Qty, T1.[ShipDate] AS [Del. Date], T1.[OpenQty] AS [Qty to Deliver] FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[ShipDate] > GETDATE() -7 AND T1.[ShipDate] < GETDATE() +7 AND T0.[DocStatus] = 'O' AND T1.[OpenQty] > 0 AND T1.[LineStatus] = 'o'

View Entire Topic
Former Member
0 Kudos

Hi David ,

Try:

SELECT T0.DocNum AS Doc, T0.CardName AS Supplier, T1.LineNum AS Row, T1.ItemCode AS Code,

T1.Dscription As Desciption, cast(T1.Quantity as integer) AS Qty, T1.ShipDate AS 'Del. Date', cast(T1.OpenQty as integer) AS 'Qty to Deliver'

FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry

WHERE T1.ShipDate > GETDATE() -7 AND T1.ShipDate < GETDATE() +7 AND T0.DocStatus = 'O'

AND T1.OpenQty > 0 AND T1.LineStatus = 'o'

Thanks,

Gordon