Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have small conversion on Qlikview Expression into SQl.
Below is my Qlikview code. I need tis in Sql.
Count({<[USER]=e({<[NEW]={'A','B','C'}>})>}distinct [USER])/count(distinct USER)
SELECT (SUM(a.USERCOUNTE)/SUM(a.TOTALUSER)) as USERNEW
FROM (
SELECT COUNT(DISTINCT b.USER) as TOTALUSER,COUNT(SELECT DISTINCT USER FROM TABLE WHERE USER NOT IN ('A','B','C')) as USERCOUNTE
FROM TABLE b ) a
UPDATE
Create flag in script for Column New
and use it in Set analysis.
Like
Load *
If(Wildmatch(New,'A','B','C'),1,0) as flag
from table;
then your expression became
Count({<Flag={'0'}>}Distinct USER)/Count(Distinct USER)
Regards
SELECT (SUM(a.USERCOUNTE)/SUM(a.TOTALUSER)) as USERNEW
FROM (
SELECT COUNT(DISTINCT b.USER) as TOTALUSER,COUNT(SELECT DISTINCT USER FROM TABLE WHERE USER NOT IN ('A','B','C')) as USERCOUNTE
FROM TABLE b ) a
UPDATE
Hi Max,
i need the equivalent sql code for testing in db.
Not in Qlivkiew
select COUNT(distinct b.[USER])/count(distinct a.[USER]) from tablename a,tablenamae b
where b.[NEW]='A' or b.[NEW]='B' or b.[NEW]='C'
Thnx Kush. i will try this code and let u know
Thnx Oza. i will try this code and let u know
Hi,
try below
select
(select
count(t1.USER)
From table t1
where NAME NOT IN ('A','B','C')
)
/ count (t2.USER)
From table t2
Regards