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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:44:20+00:00 2026-06-14T03:44:20+00:00

I need to create a SQL query to retrieve all the values from one

  • 0

I need to create a SQL query to retrieve all the values from one unique row entry in a table called JOBS.

But to do so I need to use a table called EMPLOYEES which has a foreign key to the JOBS table.
The condition is to return the job_title from the table JOBS that has its job_id more times repeated in the EMPLOYEES table.

I need to do it with one SQL statement.

Desired output:

Stock Clerk

This is the query I have

SELECT job_id  
FROM (SELECT job_id FROM employees GROUP BY job_id ORDER BY COUNT(*) desc)  
WHERE ROWNUM <= 1;

but is not good enough because it is job_title from EMPLOYEES what I need.

Do you have any idea how can I do it? I am using an Oracle 11g database

This is how my tables look like:

EMPLOYEES

EMPLOYEES

JOBS

JOBS

  • 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-14T03:44:21+00:00Added an answer on June 14, 2026 at 3:44 am
    SELECT job_title from JOBS where JOB_ID = (
    SELECT job_id FROM employees GROUP BY job_id ORDER BY COUNT(*) desc LIMIT 1)
    

    Don’t remember offhand if you can use LIMIT 1 in oracle, but if not then

    SELECT job_title from JOBS where JOB_ID = (
    SELECT job_id FROM employees GROUP BY job_id ORDER BY COUNT(*) desc where ROWNUM=1)
    

    Also note that if the top 2+ job id’s are equal, it will only print one of them (i.e. if SA_REP and ST_CLERK both appeared 4 times, only one of them would be shown)
    It’s not clear what your requirements are for this, but the above queries would only return one of them

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

Sidebar

Related Questions

I need to create an SQL query to insert some data into a table
I use MS SQL 2008 R2, I need create a Table with a CHECK
I'm having trouble creating a query. I need to create a SQL query where
I need to query a table in an SQLite database to return all the
I need to create native SQL query with couple of unions and subqueries. It'll
I need to create an sql query inside a ruby on rails application. I
I am new to SQL and databases.. I need to create an SQL query
I need to create query like (i'm using PostgreSQL): (SELECT * FROM t1 WHERE
We need to create several SQL reports, each of which depends upon the results
i am trying to create sql procedure or function that need to find duplicate

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.