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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:34:27+00:00 2026-06-11T17:34:27+00:00

I commonly use a construct somewhat like: ORDER BY CASE WHEN Location = ‘ROOT’

  • 0

I commonly use a construct somewhat like:

ORDER BY CASE WHEN Location = 'ROOT' THEN '~' ELSE Location END

In an ASCII environment this successfully pushes all records with a Location of ROOT down to the end while all others are sorted normally. This works because the ‘~’ character is close to the end of the character set. However, with the more ubiquitous use of databases with wider characters sets than ASCII I expect this technique will occasionally not work.

What alternative is there? Specifically I want a technique that will push records with a specific value in a field to the end of the list.

I am working primarily with MS SQL but I would also be interested in a general technique and one that will work with Oracle.

  • 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-11T17:34:28+00:00Added an answer on June 11, 2026 at 5:34 pm

    To push the values with Location = 'ROOT' to the end try this:

    ORDER BY CASE WHEN Location = 'ROOT' THEN 1 ELSE 0 END, Location 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When writing programs (C#.NET) I'll commonly use external libraries I've downloaded from various websites
A data structure that I use commonly in multi-threaded applications is a ConcurrentHashMap where
The STL commonly defines an output iterator like so: template<class Cont> class insert_iterator :
I commonly use Mixins in test code to share utility methods across tests. I
When building websites I commonly use tools such as Browsershots to ensure that my
Commonly, I use the same function settings. I'm wondering if there is a method,
Which one of these two is most commonly used scenario? I want to use
I'd like to: Make commonly required services visible to all classes that need them,
What techniques do people commonly use for uploading, storing and presenting images with a
While recursive scans are commonly use to scan through nested objects / data. It

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.