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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:01:24+00:00 2026-06-14T07:01:24+00:00

I need to order transaction based on the currency. However I need to implement

  • 0

I need to order transaction based on the currency.
However I need to implement a custom order by, which makes the USD to always comes on the top, and the rest should be ordered asc.

for example :

  • BHT
  • USD
  • MYR
  • JYP

should be sorted like :

  • USD
  • BHT
  • JPY
  • MYR

Is there a simple way to handle this?

  • 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-14T07:01:25+00:00Added an answer on June 14, 2026 at 7:01 am

    Don’t know if this qualifies as simple:

    order by 
        case 
           when currency = 'USD' then 1 
           when currency = 'BHT' then 2
           when currency = 'JPY' then 3
           when currency = 'MYR' then 4
           else 5
        end
    

    or a bit more compact but Oracle specific:

    order by decode(currency, 'USD', 1, 'BHT', 2, 'JPY', 3, 'MYR', 4, 5)
    

    The above solution using numbers to defined the sort order will not automatically sort currencies correctly that aren’t mentioned in the case/decode expression.

    To simply put USD at the front and don’t care about the rest, the “generated” order criteria must be a character value as well. You can use the following in that case:

    order by 
        case 
           when currency = 'USD' then '001' 
           else currency
        end
    

    Which uses an “alphabetical” ordering. This works because characters are sorted after the number digits. (Using 'AAA' instead of '001' would work as well).

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

Sidebar

Related Questions

I need to use a Custom AnnotationTransactionAttributeSource in order to intercept transaction attributes. Right
I need to ensure 2 calls are enlisted in a transaction Sub InsertOrder(order) ...insert
I'm currently writing a method which, in order to reduce transaction costs, inserts entities
I need to order by 2 columns using the entity framework. How is that
The below shown is my query I need to order by with these three
I'm starting research on what I'd need in order to build a user-level plugin
I need to validate order of my output xml against a XSD using XMLUnit
I am trying to figure out what order I need to do everything to
In order to set some varaibles i need the information if a given file
I need a jQuery to order a list like this: http://jqueryui.com/demos/sortable/ But I need

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.