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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:05:32+00:00 2026-06-11T01:05:32+00:00

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)

  • 0

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) 
And P.Player_Id=Ps.Player_Id 
and
Trunc(p.Init_Dtime) > Trunc(Sysdate) - 7 
And
Trunc(P.Create_Dtime) >= To_Date('2012-mar-01','yyyy-mon-dd')
And Trunc(P.Create_Dtime) < To_Date('2015-sep-9','yyyy-mon-dd')
Group By Trunc(P.Init_Dtime)
Order By Trunc(P.Init_Dtime) Asc

I am using the “IN” function to include only Group_IDs that have certain numbers. The Group_ID column can have a value from 1-100. How do I change this query so the result includes all Group_Id numbers that are not (44,9,42,15,23,73,45,33,69,63,7,49,96,81,28,57,98,74,92,38)?

  • 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-11T01:05:34+00:00Added an answer on June 11, 2026 at 1:05 am

    As Peter wrote, using the “NOT IN” is the real answer.
    The question is why you are using this list as a list…
    I assumed that this list have some meaning and that you may have few lists like this that “grouped” some groups together.
    If this is the case, you may want to have another table with those groups and do a join between Ps.Group_Id and this new table…


    Edit:
    On another note, If you have indexs on p.Init_Dtime or on P.Create_Dtime, Oracle can not use those indexes because you are using those columns inside a function.
    You might want to consider how to work without a function (you can add 2 more columns that will hold the truncate values for those column, indexed them as well and use them on the query)


    Edit2:
    If you want a quick and dirty replacing of the list with information from a table, just remember that you can use select inside the not in part.
    If you have table t1 with col Group_Id and col Valid_Groups, you can do:

    ... Where 
        Ps.Group_Id In (Select Group_Id from T1 where Valid_Groups = 'true') And ...
    

    Same goes to “not in” …

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

Sidebar

Related Questions

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)
I have this query: SELECT COUNT(*) AS invoice_count, IFNULL(SUM(qa_invoices.invoice_total), 0) AS invoice_total, IFNULL(SUM(qa_invoices.invoice_discount) ,0)
I have the following query select count(trade_sid), shortcode from trade where trade.trade_date <= sysdate
I have this query in DB2 SELECT * FROM SOMESCHEMA.SOMETABLE WHERE SYSDATE > @A
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`
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
i have this query: SELECT `completed`.`ID` AS `ID`,`completed`.`level` AS `level`,`completed`.`completed_in` AS `completed_in`, COUNT(1) AS
I have this query: SELECT * From checkfinale where AssociateID = 51 AND `CompletedDate`

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.