Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:14:47+00:00 2026-06-11T23:14:47+00:00

I have the following query in ORACLE SQL: Select Trunc(Cs.Create_Dtime), Count(Case When Cs.Cs_Listing_Id Like

  • 0

I have the following query in ORACLE SQL:

Select
Trunc(Cs.Create_Dtime),
Count(Case When Cs.Cs_Listing_Id Like '99999999%' Then (Cs.Player_Id) End) As Sp_Dau, 
Count(Case When Cs.Cs_Listing_Id Not Like '99999999%' Then (Cs.Player_Id) End) As Cs_Dau
From
Player_Chkin_Cs Cs
Where
Trunc(Cs.Create_Dtime) >= To_Date('2012-Jan-01','yyyy-mon-dd')
Group By Trunc(Cs.Create_Dtime)
Order By 1 ASC

I added “Distinct” just before “case” for each count. I just want to make sure that this only returns all of the distinct player_Ids in each case. Can some one confirm? Thank you! Here is the final query:

Select
Trunc(Cs.Create_Dtime),
Count(Distinct Case When Cs.Cs_Listing_Id Like '99999999%' Then (Cs.Player_Id) End) As      Sp_Dau,
Count(Distinct Case When Cs.Cs_Listing_Id Not Like '99999999%' Then (Cs.Player_Id) End)     As Cs_Dau
From
Player_Chkin_Cs Cs
Where
Trunc(Cs.Create_Dtime) >= To_Date('2012-Jan-01','yyyy-mon-dd')
Group By Trunc(Cs.Create_Dtime)
Order By 1 ASC;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:14:49+00:00Added an answer on June 11, 2026 at 11:14 pm

    A simple test case for you to prove count(distinct ... returns only distinct values:

    11:34:09 HR@vm_xe> select department_id, count(*) from employees group by department_id order by 2 desc;      
    
    DEPARTMENT_ID   COUNT(*)                                                                                      
    ------------- ----------                                                                                      
               50         45                                                                                      
               80         34                                                                                      
              100          6                                                                                      
               30          6                                                                                      
               60          5                                                                                      
               90          3                                                                                      
               20          2                                                                                      
              110          2                                                                                      
               40          1                                                                                      
               10          1                                                                                      
                           1                                                                                      
               70          1                                                                                      
    
    12 rows selected.                                                                                             
    
    Elapsed: 00:00:00.03                                                                                          
    11:34:12 HR@vm_xe> select count(department_id) "ALL", count(distinct department_id) "DISTINCT" from employees;
    
           ALL   DISTINCT                                                                                         
    ---------- ----------                                                                                         
           106         11                                                                                         
    
    1 row selected.                                                                                               
    
    Elapsed: 00:00:00.02                                                                                          
    11:34:20 HR@vm_xe>                                                                                            
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Oracle 10.2 and have the following query: select h.company, count(*) from history
I have the following query to count all data every minute. $sql= SELECT COUNT(*)
I have the following SQL query in oracle: SELECT * FROM ( SELECT s.singleid,s.titel,a.naam,s.taal,SUM(b.aantal)
I have a following oracle query: SELECT a.USER_ID, c.first_name, c.last_name, TO_CHAR( b.logon_date, 'MM/DD/YYYY HH:MI:SS
I have following query , select * from process where name like 'abc'; now
I have following SQL query SELECT TOP 10000 AVG(DailyNodeAvailability.Availability) AS AVERAGE_of_Availability FROM Nodes INNER
I have a java.sql.Clob object which I populate from an Oracle query and then
I have the following query which runs perfectly well on both Oracle and SQL
I have the following SQL query: select ID, COLUMN1, COLUMN2 from (select ID, COLUMN1,
I have a following oracle sql query in which START_DATE is a number column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.