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

  • Home
  • SEARCH
  • 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 9157079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:55:32+00:00 2026-06-17T12:55:32+00:00

I have two table, defined by this create statement CREATE TABLE PROJECT (project_name varchar(255),

  • 0

I have two table, defined by this create statement

CREATE TABLE PROJECT (project_name varchar(255), project_budget int, dedicated_project_leader int, dedicated_lead_developer int, dedicated_lead_consultant int, company_id int, project_id int, PRIMARY KEY (project_id));
CREATE TABLE WORKER (worker_name varchar(255), worker_salary int, worker_anual_bonus int, worker_type varchar(255), leader int, company_id int, project_id int, worker_id int, PRIMARY KEY (worker_id));

I’d like to ask for the sum of the budgets of the project than divide it by the number of the workers—)

SELECT (SUM(p.project_budget) / (SELECT count(WORKER.WORKER_NAME) from WORKER)) as AVG_BONUS
  FROM PROJECT p;

Unfortunateley this raise an “ORA–00937:not a single-group group function” exception.

However if i execute this query:

SELECT count(WORKER.WORKER_NAME) from WORKER)

The result will be:

16

And if i divide the summa of budgets with the number instead of the result:

SELECT (SUM(p.project_budget) / 16) as AVG_BONUS
      FROM PROJECT p;

I also got a perfect result e.g.:

294117,647058823

The solution is that i need to group by some id defined at the project table, but don’t think it is logical….

SELECT (SUM(p.project_budget) / (SELECT count(WORKER.WORKER_NAME) from WORKER)) as AVG_BONUS
  FROM PROJECT p
   GROUP BY p.company_id;

It is also working.

Is anyone has a suggestion why can’t i use it? (I have a feeling it is only an sql language specification that there can not exist two group function at a select without group by…)

  • 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-17T12:55:33+00:00Added an answer on June 17, 2026 at 12:55 pm

    you have to push each aggregate in this case into its own non-dependant view..eg:

    select budget/workers
      from (select (select sum(p.project_budget) from project p) budget,
                   (select count(w.worker_name) from worker w) workers
              from dual);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables defined as such: CREATE TABLE [SomeTable] ( [PrincipalID] [int] IDENTITY(1,1)
I have a table defined like this CREATE TABLE OrderItemRoomings( OrderItemRoomingId int IDENTITY(1,1) NOT
I have a table defined like this: CREATE TABLE mytable (id INT NOT NULL
I have a User table defined like this: CREATE TABLE Users( UserId int IDENTITY(1,1)
I have two tables A and B as defined bellow. create table A (
I have this table.. CREATE TABLE [dbo].[Tipo_Servicios_Info]( [TSI_TS_Id] [int] NOT NULL, [TS_Tar_Id] [int] NOT
I have two table like this table_CN (_id, name, phone, favorite, title) table_EN (_id,
i have two table: declare @t1 table (id int) declare @t2 table (id int)
Suppose I have two queries on a database table. The queries are defined in
I have a many-to-many relationship defined between two entities using an association table and

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.