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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:06:22+00:00 2026-05-25T14:06:22+00:00

I am trying to get the dname, loc, and count the ename’s, plus I

  • 0

I am trying to get the dname, loc, and count the ename’s, plus I want to include the sal from the table. Can someone tell me what I am doing wrong.

Heres my statement with the error I get

 SQL> select dname, loc, (select count(ename), sal from emp where DEPTNO =   dept.deptno) as Number_of_people  from dept;
 select dname, loc, (select count(ename), sal from emp where DEPTNO = dept.deptno) as  Number_of_people  from dept
                *
 ERROR at line 1:
 ORA-00913: too many values


 SQL>

Heres my table

SQL> select empno, ename, job, hiredate, sal from emp;

 EMPNO ENAME      JOB       HIREDATE         SAL
---------- ---------- --------- --------- ----------
  7839 KING       PRESIDENT 17-NOV-81       5000
  7698 BLAKE      MANAGER   01-MAY-81       2850
  7782 CLARK      MANAGER   09-JUN-81       2450
  7566 JONES      MANAGER   02-APR-81       2975
  7654 MARTIN     SALESMAN  28-SEP-81       1250
  7499 ALLEN      SALESMAN  20-FEB-81       1600
  7844 TURNER     SALESMAN  08-SEP-81       1500
  7900 JAMES      CLERK     03-DEC-81        950
  7521 WARD       SALESMAN  22-FEB-81       1250
  7902 FORD       ANALYST   03-DEC-81       3000
  7369 SMITH      CLERK     17-DEC-80        800

 EMPNO ENAME      JOB       HIREDATE         SAL
 ---------- ---------- --------- --------- ----------
  7788 SCOTT      ANALYST   09-DEC-82       3000
  7876 ADAMS      CLERK     12-JAN-83       1100
  7934 MILLER     CLERK     23-JAN-82       1300

 14 rows selected.

 SQL>

Heres the second table

SQL> select * from dept;

DEPTNO DNAME          LOC
---------- -------------- -------------
    10 ACCOUNTING     NEW YORK
    20 RESEARCH       DALLAS
    30 SALES          CHICAGO
    40 OPERATIONS     BOSTON

 SQL>
  • 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-25T14:06:22+00:00Added an answer on May 25, 2026 at 2:06 pm

    To get number of people and total Salary, try this…

     select dept.dname, dept.loc, 
            count(emp.ename) as Number_of_people, sum(emp.sal) as Total_Salary
     from emp 
     join dept on emp.DEPTNO = dept.deptno
     group by dept.dname,dept.loc
    

    You can get other things as well

     select dept.dname, dept.loc, 
            count(emp.ename) as Number_of_people, 
            sum(emp.sal) as Total_Salary,
            avg(emp.sal) as Average_salary,
            min(emp.hiredate) as First_dept_hire,
            max(emp.hireDate) as Last_dept_hire
     from emp 
     join dept on emp.DEPTNO = dept.deptno
     group by dept.dname,dept.loc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get this expression to work, can someone look at it and tell
I have a problem trying to get data from a table (via entity) using
I am trying to get data from two different table and put into on
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
I am trying to query the department name from one table, using the id
i'm trying to get coordinates from geolocation for use in my yahoo map.i had
I've been trying to get the Count for my Value field in my query
I am trying to validate a form, but I can't get any code to
So i am trying get 2 div-containers which both should contain centered text (Both
I am trying get all html links within a string and replace them using

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.