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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:10:03+00:00 2026-05-14T15:10:03+00:00

I have a table with shifts history along with emp ids. I’m using this

  • 0

I have a table with shifts history along with emp ids.

I’m using this query to retrieve a list of employees and their total shifts by specifying the range to count from:

SELECT ope_id, count(ope_id)
FROM operator_shift
WHERE ope_shift_date >=to_date( '01-MAR-10','dd-mon-yy') and ope_shift_date
<= to_date('31-MAR-10','dd-mon-yy')
GROUP BY OPE_ID 

which gives

   OPE_ID      COUNT(OPE_ID)
     1            14
     2             7
     3             6
     4             6
     5             2
     6             5
     7             2
     8             1
     9             2
    10             4

10 rows selected.

How do I choose the employee with the highest number of shifts under the specified range date?

  • 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-14T15:10:03+00:00Added an answer on May 14, 2026 at 3:10 pm

    Assuming your version of Oracle is new enough to support common table expressions:

    With ShiftCounts As
        (
        SELECT ope_id, count(ope_id) ShiftCount
            , ROW_NUMBER() OVER( ORDER BY Count(ope_id) Desc ) ShiftRank
        FROM operator_shift
        WHERE ope_shift_date >=to_date( '01-MAR-10','dd-mon-yy') 
            and ope_shift_date <= to_date('31-MAR-10','dd-mon-yy')
        GROUP BY OPE_ID 
        )
    Select ope_id, ShiftCount
    From ShiftCounts
    Where ShiftRank = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using MySQL 5 I have a table like this: date (varchar) door (varchar) shift
I have a MySQL table called employees . There's another table called shifts that
I have table with some fields that the value will be 1 0. This
I have a table like this below. And there is a div container with
I have a table that looks like this: (so you can picture it visually)
I have two tables, categories and products. I am using CodeIgniter. Categories CREATE TABLE
I have a table, and I'm allowing users to 'select' multiple rows. This is
I have a nested hash table that looks like this: my %myhash = (
Problem: I have a large database table (~500k records) which has a list of
I have a Table [Name Table] and an associated table workSchedule . I'm 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.