I have a simple query where I needed to see if a qty had decimal places. I was instructed to use field_name%1 as shown below. It works. I'm just trying to understand the process so I can learn more. What is the %1 doing/calculating?
SELECT m.item_id
, l.qty_on_hand
FROM inv_loc l
INNER JOIN inv_mast m
ON m.inv_mast_uid = l.inv_mast_uid
WHERE l.qty_on_hand%1 <> 0
% returns a remainder from division.
So, 1.1 % 1 yields 0.1.
2.54 % 1 = 0.54
3.0 % 1 = 0.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
June 9, 2021 at 9:46 pm
Simple enough. It just takes the field name and divides by 1, removes any whole number, and returns the balance. In this case, decimals. Thank you.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply