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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:07:36+00:00 2026-05-26T23:07:36+00:00

I have a database whose columns are npID, title, URL, and issue. Here is

  • 0

I have a database whose columns are npID, title, URL, and issue.

Here is an example of two years’ entries:

npID               title               URL               issue
88                 EMR Newsletter      a.com             2010 Third_Quarter
89                 EMR Newsletter      b.com             2010 Second_Quarter
43                 EMR Newsletter      c.com             2010 First_Quarter
47                 EMR Newsletter      d.com             2009 Winter
45                 EMR Newsletter      e.com             2009 Summer
46                 EMR Newsletter      f.com             2009 Spring
44                 EMR Newsletter      g.com             2009 Fall

What I would like to do is be able to sort the results based on substrings within the “issue” column. However, until 2010, the client used seasons as the header and in 2010, they started using quarters. Is there a way in the “ORDER BY” I can provide a list of words to sort by if/when they’re found anywhere in the “issue” value?

I would like the end result to be something like this:

npID               title               URL               issue
43                 EMR Newsletter      c.com             2010 First_Quarter
89                 EMR Newsletter      b.com             2010 Second_Quarter
88                 EMR Newsletter      a.com             2010 Third_Quarter
47                 EMR Newsletter      d.com             2009 Winter
45                 EMR Newsletter      e.com             2009 Summer
46                 EMR Newsletter      f.com             2009 Spring
44                 EMR Newsletter      g.com             2009 Fall
  • 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-26T23:07:38+00:00Added an answer on May 26, 2026 at 11:07 pm

    You can put a CASE statement in the ORDER BY to accomplish this. A better route would be to change the application and table to actually store this relevant data in columns where it belongs when you have the development time to do that.

    ORDER BY
        CAST(SUBSTRING(issue, 1, 4) AS INT) DESC,  -- Year
        CASE
            WHEN issue LIKE '%First_Quarter' OR issue LIKE '%Winter' THEN 1
            WHEN issue LIKE '%Second_Quarter' OR issue LIKE '%Spring' THEN 2
            WHEN issue LIKE '%Third_Quarter' OR issue LIKE '%Summer' THEN 3
            WHEN issue LIKE '%Fourth_Quarter' OR issue LIKE '%Fall' THEN 4
        END
    

    Order the seasons however you want. You could also order them in a specific way (Q1 followed by Spring, followed by Q2, etc.) by adjusting the CASE statement.

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

Sidebar

Related Questions

I have a client with a hosted MySQL database whose developer keeps asking me
I have an ActiveRecord model whose fields mostly come from the database. There are
I am facing problem with Inner join in Access Database. I have two table
I have a table ( sessions ) in a database whose 1st column contain
I have a MySQL database whose keys are of this type: A_10 A_10A A_10B
We have a database with a table whose values were imported from another system.
Let's say you have a database with two tables named clients and referrals. TABLE
I have a C# program that selects data from two different database files and
I have some database records, and one of the columns contains the date the
I would like to have a table in my Oracle database whose rows act

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.