test percentage

0

Please login or register to vote for this query.

(click on this box to dismiss)

Russian Language

Q&A for students, teachers, and linguists wanting to discuss the finer points of the Russian language

SET ANSI_WARNINGS  OFF;
DECLARE @subContractorMarkedCode table(quantity INTEGER, clientCusSubCont varchar, codesStatus2 varchar, codesStatus16 varchar, codesStatus32 varchar, codesStatus64 varchar)
INSERT @subContractorMarkedCode
values(100,'Gucci','Item Associated','','',''),
(5,'Gucci','Item Associated','Cloned','',''),
(10,'Gucci','Item Associated','Cloned','Blocked',''),
(5,'Gucci','Item Associated','Cloned','Blocked','Stolen'),
(150,'Nike','Item Associated','','',''),
(20,'Nike','Item Associated','','Blocked',''),
(50,'Dior','Item Associated','','',''),
(30,'Dior','Item Associated','Cloned','','')
SET ANSI_WARNINGS ON;

with den (q, c) as (Select sum(quantity),clientCusSubCont from @subContractorMarkedCode where codesStatus2 is not null group by clientCusSubCont),
num(q2, c2) as (Select sum(quantity),clientCusSubCont from @subContractorMarkedCode where codesStatus2 is not null and (codesStatus16 is not null or codesStatus32 is not null or codesStatus64 is not null) group by clientCusSubCont)

select q/num.q2 from den inner join num on num.c2=c

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results