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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:14:58+00:00 2026-05-22T16:14:58+00:00

A quick background — I need to find the termination rates of cases that

  • 0

A quick background — I need to find the termination rates of cases that go through our company lab grouped by case type and month. So far I came up with this:

SELECT BPI.TYPE,
       EXTRACT(MONTH FROM CS.RECEIVED_DATE) MONTH,
       COUNT(*) termed_cases
  FROM CELL_SOURCE cs
  JOIN BASIC_PATHOLOGY_INFO bpi ON CS.CELL_SOURCE_ID = BPI.CELL_SOURCE_ID
  JOIN RECENT_CELL_SOURCE_STATUS rcss ON CS.CELL_SOURCE_ID = RCSS.CELL_SOURCE_ID
 WHERE type IS NOT NULL
  AND CS.RECEIVED_DATE > to_date('03/01/2011', 'MM/DD/YYYY/')
  AND RCSS.STATUS like 'Term%'
GROUP BY BPI.TYPE, EXTRACT(MONTH FROM CS.RECEIVED_DATE)
ORDER BY month, type

This finds all cases that have been termed, easy enough. However, when I want to find the rate, I get a bit of a problem. I tried using a sub-query to catch the total amount of cases per type regardless of it’s status, as such:

COUNT(*)/(SELECT COUNT(*) 
            FROM CELL_SOURCE cs_1 
            JOIN BASIC_PATHOLOGY_INFO bpi_1 ON CS_1.CELL_SOURCE_ID = BPI_1.CELL_SOURCE_ID
          WHERE BPI_1.TYPE = BPI.TYPE 
            AND EXTRACT(month from CS_1.RECEIVED_DATE) = EXTRACT(MONTH FROM CS.RECEIVED_DATE)) termed_cases

However, this throws an ORA-00979: not a GROUP BY expression error, and highlights BPI.TYPE from the sub-query.

Anyone have any idea what my error could actually be? Also, would an analytical function work better here than an aggregate function?

  • 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-05-22T16:14:58+00:00Added an answer on May 22, 2026 at 4:14 pm

    So, you need two counts: a total for all cases in the month and a total for just the Termed cases. The easiest way of doing this is to use a CASE() function to execute a conditional count, like this:

    SELECT BPI.TYPE,
           EXTRACT(MONTH FROM CS.RECEIVED_DATE) MONTH,
           COUNT(*) all_cases,
           sum(case when RCSS.STATUS like 'Term%' then 1 else 0 end ) termed_cases
      FROM CELL_SOURCE cs
      JOIN BASIC_PATHOLOGY_INFO bpi ON CS.CELL_SOURCE_ID = BPI.CELL_SOURCE_ID
      JOIN RECENT_CELL_SOURCE_STATUS rcss ON CS.CELL_SOURCE_ID = RCSS.CELL_SOURCE_ID
     WHERE tumor_type IS NOT NULL
      AND CS.RECEIVED_DATE > to_date('03/01/2011', 'MM/DD/YYYY/')
    GROUP BY BPI.TUMOR_TYPE, EXTRACT(MONTH FROM CS.RECEIVED_DATE)
    ORDER BY month, tumor_type
    

    Note that I have removed the LIKE filter from the WHERE clause.

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

Sidebar

Related Questions

Quick Background: I write excel macros for a company that uses shared drives on
Quick background info: of the three database tables that are relevant for this question,
Quick background. CFHTTP doesn't support Windows NTLM/Authenticate authentication, only basic authentication. I need to
Quick background: writing a module. One of my objects has methods that may or
Real quick background : We have a PDFMaker (HTMLDoc) that converts html into a
Some quick background on my problem: I'm writing a compiler that converts Domain Type
Here's the quick background: I've got a client and a server program that are
Background In Java, I want to make a simple, quick console app that provides
So the quick background is that I have a page listing a set of
So the quick background is I am creating a java program, that uses many

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.