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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:33:15+00:00 2026-06-11T16:33:15+00:00

Okay, this should be a fairly easy question I think, but haven’t been able

  • 0

Okay, this should be a fairly easy question I think, but haven’t been able to figure it out yet.

I have a table entitled Staff. The staff DESC is below:

SQL> DESC Staff
Name                                      Null?    Type
----------------------------------------- -------- ----------
SNO                                       NOT NULL CHAR(5)
FNAME                                              VARCHAR2(3
LNAME                                              VARCHAR2(3
POSITION                                           VARCHAR2(1
SEX                                                CHAR(1)
DOB                                                DATE
SALARY                                             NUMBER(9)
BNO                                                CHAR(4)

Here is the current query I am using:

SELECT bNo, lName||' '||fName, position, salary
FROM Staff
WHERE bNo 'b009'
OR bNo = 'b005'
ORDER BY 
    case position
        when 'Manager' then 1
        when 'Secretary' then 2
        when 'Supervisor' then 3
        when 'Assistant' then 4
    else 99
end;

The problem I am having is that within each position group, I need to sort by lName as well. Any tips would be greatly appreciated. Thanks in advance.

  • 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-11T16:33:16+00:00Added an answer on June 11, 2026 at 4:33 pm

    Just add lName as a second ORDER BY column.

    ORDER  BY CASE position
                WHEN 'Manager' THEN 1
                WHEN 'Secretary' THEN 2
                WHEN 'Supervisor' THEN 3
                WHEN 'Assistant' THEN 4
                ELSE 99
              END,
              lName; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, this should be painfully obvious, however I haven't been able to figure out
Okay, so this should be a simple question, but I'm fairly new at programming,
Okay this is definitley an easy question and a stupid one but since I
Okay this may be a simple question but I have yet to come with
Okay so this query should be easy but I'm having a bit of difficult.
Okay, this should be an easy one for the pros out there (disclaimer, I'm
Okay this is definitely a n00b question but here goes. The way I understand
I think this should be a rather simple thing to do, but I'm completely
This should have been a simple thing to sort but even after extensive research
Okay so I am a little confused. This should be a simple straightforward question

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.