SELECT
LTRIM(( CASE WHEN ( ( SUM(sn.OrderNum - sn.ItemNoNum) - 1 ) < 0 )
THEN '0.0000'
ELSE CONVERT(FLOAT, SUM(sn.OrderNum - sn.ItemNoNum)) * 1.0
/ CONVERT(FLOAT, ( SUM(sn.OrderNum - sn.ItemNoNum) ))
END )) + '%'
------解决方案--------------------
SQL code
SELECT LTRIM((CASE WHEN ((SUM(sn.OrderNum-sn.ItemNoNum)-1) < 0) THEN 0.00
ELSE SUM(sn.OrderNum-sn.ItemNoNum)*100.0/CONVERT(FLOAT , (SUM(sn.OrderNum-sn.ItemNoNum)))
END ))+'%'
------解决方案--------------------