Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

ADD PCS INTO DOZENS

Hi All,

I have data dozens and pcs.

I want to add those pcs >=12 into dozens, and remain pcs < 12.

Below is my code, but failed to achieve it.
 
 SUM(QtyLsn) +  FLOOR(CAST(SUM(QtyPcs)/12 AS MONEY)) AS QtyLsn
 , SUM(QtyPcs)  - FLOOR(CAST(SUM(QtyPcs)/12 AS MONEY)) AS QtyPcs

How could I do it ?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of WyTyz
WyTyz
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of emi_sastra
emi_sastra

ASKER

Yes, it works.

I use :

 SUM(QtyLsn) +  CAST(SUM(QtyPcs)/12 AS INT) AS QtyLsn
 , SUM(QtyPcs) % 12 AS QtyPcs

Thank you very much for your hep.