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 8504479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:02:42+00:00 2026-06-11T02:02:42+00:00

I have this query: Select Trunc(Create_Dtime),Count(Trunc(Create_Dtime)) as Day_0 From Player Group By Trunc(Create_Dtime) Order

  • 0

I have this query:

Select Trunc(Create_Dtime),Count(Trunc(Create_Dtime)) as Day_0 From Player
Group By Trunc(Create_Dtime)
Order By Trunc(Create_Dtime) Asc

It gives me back dates but if a date doesn’t have any results, that is skipped. I’d like to fill in all dates from 8-05-12 to present, and if those days don’t have any values, just have a 0 in the results.

  • 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-11T02:02:43+00:00Added an answer on June 11, 2026 at 2:02 am

    Depending on how you want to create them you can either create a calender table or generate the rows dynamically using the Oracle connect by syntax.

    with the_dates as (
      select max(trunc(Create_Dtime)) as max_date
           , min(trunc(Create_Dtime)) as min_date
        from player 
             )
      , generator as (
      select min_date + level as the_date
        from the_dates
     connect by level <= max_date
             )
    select g.the_date, count(trunc(p.Create_Dtime))
      from generator g
      left outer join player p
        on g.the_date = trunc(p.Create_Dtime)
     group by g.the_date
     order by g.the_date desc
    

    If you go down the calender table option it’s a little bit cleaner:

    with the_dates as (
      select max(trunc(Create_Dtime)) as max_date
           , min(trunc(Create_Dtime)) as min_date
        from player 
             )
    select c.the_date, count(trunc(p.Create_Dtime))
      from calender c
      join the_dates td
        on c.the_date between td.min_date and td.max_date
      left outer join join player p
        on c.the_date = trunc(p.Create_Dtime)
     group by c.the_date
     order by c.the_date
    

    Or, having just noticed your date constraints:

    with the_dates as (
      select to_date('07-05-2012','dd-mm-yyyy') + level as the_date
        from dual
     connect by level <= trunc(to_date('07-05-2012','dd-mm-yyyy') - sysdate)
             )
     select td.the_date, count(trunc(p.create_dtime))
       from the_dates td
       left outer join player p
         on td.the_date = trunc(p.create_dtime)
      group by td.the_date
      order by td.the_date
    

    For all of these I’d recommend an index on trunc(create_dtime) on your player table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query: Select Sysdate,Sum(Count(P.Init_Dtime)) From Player p,player_source ps Where Ps.Group_Id In (44,9,42,15,23,73,45,33,69,63,7,49,96,81,28,57,98,74,92,38)
I have a query that spits out a result: Select Sum(Count(P.Create_Dtime)), From Player P
I have the following query: Select Player_Id, Pt_Credit As Total_Points From Player Where Trunc(Create_Dtime)
So i have this query: SELECT p.*, d.reviews, TRUNC(ds.ratingAvg, 2) as ratingAvg FROM place
I have this query: SELECT COUNT( tbl_workstation.workstation_id ) AS AVAILABLE, tbl_lab.room_no, tbl_lab.capacity FROM tbl_workstation,
I have a simple query that spits out new_users by day... Select trunc(create_dtime),Count(Player_Id) as
I have the following query in ORACLE SQL: Select Trunc(Cs.Create_Dtime), Count(Case When Cs.Cs_Listing_Id Like
I have this simple query: Select To_Date('2012-sep-03','yyyy-mon-dd')as Date_Of_Concern, Count(Player_Id) as Retained From Player Where
I have this query: SELECT (SUM(tblTransaction.AmountPaid) - SUM(tblTransaction.AmountCharged)) AS TenantBalance, tblTransaction.TenantID FROM tblTransaction GROUP
I have this query: SELECT COUNT(*) AS `numrows` FROM (`tbl_A`) JOIN `tbl_B` ON `tbl_A`.`B_id`

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.