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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:54:32+00:00 2026-06-10T22:54:32+00:00

I have two querys below, both of which are feeding from the same "player"

  • 0

I have two querys below, both of which are feeding from the same "player" table. I want to divide query 1 by query 2 to get a relevant percentage. Im relatively new to more detailed SQL queries, as well as posting on forums…but please let me know if you have any suggestions on how to combine this to get the relevant percentage result.

1

Select
  sysdate,sum(Count(init_dtime))
From Player p
Where
  Trunc(Init_Dtime) > Trunc(Sysdate) - 7 
  And Trunc(Create_Dtime) >= To_Date('2012-mar-01','yyyy-mon-dd')
  and trunc(create_dtime) < to_date('2015-sep-9','yyyy-mon-dd')
Group By Trunc(Init_Dtime)
Order By Trunc(Init_Dtime) Asc

2

Select
  Sum(Count(Create_Dtime))
From Player P
where 
  Trunc(Create_Dtime) >= To_Date('2012-mar-01','yyyy-mon-dd')
  And Trunc(Create_Dtime) < To_Date('2015-sep-9','yyyy-mon-dd')
Group By Trunc(create_Dtime)
Order By Trunc(create_Dtime) 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-10T22:54:33+00:00Added an answer on June 10, 2026 at 10:54 pm

    You can just say

    select sysdate,
           count((init_dtime)) / sum((Create_Dtime)) * 100 as percentage
      from Player p
     where Trunc(Init_Dtime) > Trunc(Sysdate) - 7 
       and Trunc(Create_Dtime) >= To_Date('2012-mar-01','yyyy-mon-dd')
       and trunc(create_dtime) < to_date('2015-sep-9','yyyy-mon-dd')
       order by percentage asc
    

    The group by in the SQLs are not needed as you are not really grouping by something. group by is useful when you need the percentage by player, for instance. Then you would say group by player_id and in the select would have the player_id:

    select player_id, count(…)
      from …
     where …
    group by player_id
    

    EDIT:
    If the where clauses are different:

    select sysdate, 
           (
               (select count((init_dtime))
                 from player p
                where trunc(Init_Dtime) > trunc(Sysdate) - 7 
                  and Trunc(Create_Dtime) >= To_Date('2012-mar-01','yyyy-mon-dd')
                  and trunc(create_dtime) < to_date('2015-sep-9','yyyy-mon-dd'))
                / 
               (select count((Create_Dtime))
                  from player P
                 where trunc(Create_Dtime) >= To_Date('2012-mar-01','yyyy-mon-dd')
                   and trunc(Create_Dtime) < To_Date('2015-sep-9','yyyy-mon-dd'))
           ) * 100 as percentage
    from dual
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK I have two sql tables I need to query from which are product
I have two separate columns within the same table in my database. Both of
I have two selection queries and i want to select values from both and
I have two tables described below. What I need is a single query that
I have two mysql tables which both have a typeID in common. I am
I am wonder about how to update the table. I have use below two
I have a sql table called predictions with data as below Week Player Points
I have to below 2 LINQ statements. They both return (seemingly) the same result
I have two table in my data base As below: CUSTOMER ( ID integer
I have two table like below CREATE TABLE IF NOT EXISTS `countries` ( `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.