why Case count distinct not returning correct values [on hold]LNNVL JustificationEfficiently finding distinct...
Can neural cryptanalysis be applied to AES?
How can I learn to care less because it makes me sick?
This Website Needs More Cat Pictures?
Run a command that requires sudo after a time has passed
Finding Gaps in Date Ranges
Is 'bad luck' with former employees a red flag?
What happens to someone who dies before their clone has matured?
Is there a limit on the layers of encryption a file can have?
How can guns be countered by melee combat without raw-ability or exceptional explanations?
Coworker is trying to get me to sign his petition to run for office. How to decline politely?
Ethernet cable only works in certain positions
Why is Shelob evil?
What happens if you declare more than $10,000 at the US border?
Why are these receptacles so difficult to plug into?
How to explain one side of Super Earth is smoother than the other side?
If an area is covered in both Ball Bearings and Caltrops, does the creature need to move at half speed or quarter speed to avoid both their effects?
As per hinduism, does life span of human depends on his respiratory breaths?
Is candidate anonymity at all practical?
Why don't hotels offer ≥ 1 kitchen that must be booked?
Why do most space probes survive for far longer than they were designed for?
Arbitrary Interval Ruler
Why, in A Midsummer Night's Dream, does "square" mean "quarrel"?
What happens when the last remaining players refuse to kill each other?
How does a single engine tail wheel landing gear airplane turn when it is on the ground?
why Case count distinct not returning correct values [on hold]
LNNVL JustificationEfficiently finding distinct valuessdo_tune.quality_degradation returning negative valuesOracle TRANSLATE Not Returning Expected ResultDISTINCT not using an indexWhy is Oracle's dbms_metadata.get_ddl returning different results?Oracle date not returning the right dataSub-Query group-by count(*) not returning 0Is COUNT(DISTINCT PRIMARY_KEY) faster than COUNT(*)?SQL Count function returning inaccurate results
I am trying to get a count of employees based on a case statement with count. I want the code to return a true if the condition defined is true otherwise it should return a null or zero but its returning a one even when the condition is evaluating to false: any suggestions on how I can rewrite the code to get correct output?
SELECT count(DISTINCT CASE
WHEN (bb.m_name IS NULL OR bb.m_name NOT IN ('Duplicate application', 'MVR Failed', 'Matched to other job', 'Not Eligible:: Not eligible for rehire', 'Not Eligible:: Not eligible to reapply yet'))
AND aa.sts_name IN ('Application Review - Rejected', 'Rejected - Application Review')
THEN 1
END) AS apr,
aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num
FROM eve_f aa,
mt_d bb,
rq_d cc
WHERE bb.wid = aa._wid
AND aa.row_wid = cc.row_wid
AND aa.c_num = '12345'
GROUP BY aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num;
oracle
put on hold as unclear what you're asking by ypercubeᵀᴹ, jadarnel27, MDCCL, Paul White♦ 12 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
|
show 2 more comments
I am trying to get a count of employees based on a case statement with count. I want the code to return a true if the condition defined is true otherwise it should return a null or zero but its returning a one even when the condition is evaluating to false: any suggestions on how I can rewrite the code to get correct output?
SELECT count(DISTINCT CASE
WHEN (bb.m_name IS NULL OR bb.m_name NOT IN ('Duplicate application', 'MVR Failed', 'Matched to other job', 'Not Eligible:: Not eligible for rehire', 'Not Eligible:: Not eligible to reapply yet'))
AND aa.sts_name IN ('Application Review - Rejected', 'Rejected - Application Review')
THEN 1
END) AS apr,
aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num
FROM eve_f aa,
mt_d bb,
rq_d cc
WHERE bb.wid = aa._wid
AND aa.row_wid = cc.row_wid
AND aa.c_num = '12345'
GROUP BY aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num;
oracle
put on hold as unclear what you're asking by ypercubeᵀᴹ, jadarnel27, MDCCL, Paul White♦ 12 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
WhyDISTINCT CASE WHEN x THEN 1 END
?. There are no distinct values here.
– McNets
20 hours ago
I am trying to get a count of job numbers , so the 1 means that they have an application that does to evaluate to try according to the code here
– Sly
20 hours ago
2
Try with SUM(CASE WHEN x THEN 1 ELSE 0 END)
– McNets
20 hours ago
or remove theDISTINCT
.
– ypercubeᵀᴹ
19 hours ago
2
Show us the results then, that you get when you remove the COUNT() and the the GROUP BY.
– ypercubeᵀᴹ
19 hours ago
|
show 2 more comments
I am trying to get a count of employees based on a case statement with count. I want the code to return a true if the condition defined is true otherwise it should return a null or zero but its returning a one even when the condition is evaluating to false: any suggestions on how I can rewrite the code to get correct output?
SELECT count(DISTINCT CASE
WHEN (bb.m_name IS NULL OR bb.m_name NOT IN ('Duplicate application', 'MVR Failed', 'Matched to other job', 'Not Eligible:: Not eligible for rehire', 'Not Eligible:: Not eligible to reapply yet'))
AND aa.sts_name IN ('Application Review - Rejected', 'Rejected - Application Review')
THEN 1
END) AS apr,
aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num
FROM eve_f aa,
mt_d bb,
rq_d cc
WHERE bb.wid = aa._wid
AND aa.row_wid = cc.row_wid
AND aa.c_num = '12345'
GROUP BY aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num;
oracle
I am trying to get a count of employees based on a case statement with count. I want the code to return a true if the condition defined is true otherwise it should return a null or zero but its returning a one even when the condition is evaluating to false: any suggestions on how I can rewrite the code to get correct output?
SELECT count(DISTINCT CASE
WHEN (bb.m_name IS NULL OR bb.m_name NOT IN ('Duplicate application', 'MVR Failed', 'Matched to other job', 'Not Eligible:: Not eligible for rehire', 'Not Eligible:: Not eligible to reapply yet'))
AND aa.sts_name IN ('Application Review - Rejected', 'Rejected - Application Review')
THEN 1
END) AS apr,
aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num
FROM eve_f aa,
mt_d bb,
rq_d cc
WHERE bb.wid = aa._wid
AND aa.row_wid = cc.row_wid
AND aa.c_num = '12345'
GROUP BY aa.c_num,
aa.st_name,
aa.sts_name,
bb.m_name,
cc.co_num;
oracle
oracle
edited 21 hours ago
a_horse_with_no_name
39.9k776112
39.9k776112
asked 21 hours ago
SlySly
16
16
put on hold as unclear what you're asking by ypercubeᵀᴹ, jadarnel27, MDCCL, Paul White♦ 12 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by ypercubeᵀᴹ, jadarnel27, MDCCL, Paul White♦ 12 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
WhyDISTINCT CASE WHEN x THEN 1 END
?. There are no distinct values here.
– McNets
20 hours ago
I am trying to get a count of job numbers , so the 1 means that they have an application that does to evaluate to try according to the code here
– Sly
20 hours ago
2
Try with SUM(CASE WHEN x THEN 1 ELSE 0 END)
– McNets
20 hours ago
or remove theDISTINCT
.
– ypercubeᵀᴹ
19 hours ago
2
Show us the results then, that you get when you remove the COUNT() and the the GROUP BY.
– ypercubeᵀᴹ
19 hours ago
|
show 2 more comments
WhyDISTINCT CASE WHEN x THEN 1 END
?. There are no distinct values here.
– McNets
20 hours ago
I am trying to get a count of job numbers , so the 1 means that they have an application that does to evaluate to try according to the code here
– Sly
20 hours ago
2
Try with SUM(CASE WHEN x THEN 1 ELSE 0 END)
– McNets
20 hours ago
or remove theDISTINCT
.
– ypercubeᵀᴹ
19 hours ago
2
Show us the results then, that you get when you remove the COUNT() and the the GROUP BY.
– ypercubeᵀᴹ
19 hours ago
Why
DISTINCT CASE WHEN x THEN 1 END
?. There are no distinct values here.– McNets
20 hours ago
Why
DISTINCT CASE WHEN x THEN 1 END
?. There are no distinct values here.– McNets
20 hours ago
I am trying to get a count of job numbers , so the 1 means that they have an application that does to evaluate to try according to the code here
– Sly
20 hours ago
I am trying to get a count of job numbers , so the 1 means that they have an application that does to evaluate to try according to the code here
– Sly
20 hours ago
2
2
Try with SUM(CASE WHEN x THEN 1 ELSE 0 END)
– McNets
20 hours ago
Try with SUM(CASE WHEN x THEN 1 ELSE 0 END)
– McNets
20 hours ago
or remove the
DISTINCT
.– ypercubeᵀᴹ
19 hours ago
or remove the
DISTINCT
.– ypercubeᵀᴹ
19 hours ago
2
2
Show us the results then, that you get when you remove the COUNT() and the the GROUP BY.
– ypercubeᵀᴹ
19 hours ago
Show us the results then, that you get when you remove the COUNT() and the the GROUP BY.
– ypercubeᵀᴹ
19 hours ago
|
show 2 more comments
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Why
DISTINCT CASE WHEN x THEN 1 END
?. There are no distinct values here.– McNets
20 hours ago
I am trying to get a count of job numbers , so the 1 means that they have an application that does to evaluate to try according to the code here
– Sly
20 hours ago
2
Try with SUM(CASE WHEN x THEN 1 ELSE 0 END)
– McNets
20 hours ago
or remove the
DISTINCT
.– ypercubeᵀᴹ
19 hours ago
2
Show us the results then, that you get when you remove the COUNT() and the the GROUP BY.
– ypercubeᵀᴹ
19 hours ago