How to declare the sort order

Hello

I have the following query:

Select the State
from table_1
order by 1;

status
--------
Fact
Fact
In the process
Terminated
Terminated


But I want to sort like this:

status
--------
In the process
Terminated
Terminated
Fact
Fact

Process - 1
End - 2
Fact - 3

Any idea?

Thank you!

Hello
Try this:

SELECT status
FROM table_1
ORDER BY the status of the CASE WHEN "in the process" THEN 1 2 3 OTHER THEN the EXPRESSION "Terminated" END;

Tags: Database

Similar Questions

  • How to change the sort order of the items sought for the last element of this research first. I DON'T want to say the order search engines, but the existing research by arrow down

    I want to be able to change the sort order of the items, I already looked in the search box. I want to be able to hit the arrow key down and see my previous searches in order of last search showing the first. For the moment, I don't know how it is sorting and it is very annoying to have to re - enter a query that I typed 5 minutes earlier, but because I typed in another 10 since it's lost somewhere in the list. Is it possible, I Googled, but did not find the topic anywhere. Just to clarify, I DON'T mean of the order of the search engines (which is what appears in google), I mean that the text typed into which has been registered in the drop-down list.

    Thank you

    'Form filling' uses a "frecency" algorithm, frequency + recency, similar to the list of AutoComplete address bar.

    I found an extension that seems relevant, but critics are old, so I'm not sure it's still working: Searchbar Autocomplete Order.

    But... is the AutoComplete does not? I expect that typing a few characters of the previous query would be to filter the list so that you can easily select? Or is the problem that the list does not remember quite who looking for?

  • How to keep the sort order when you rename a collection?

    I renamed a manually sorted Collection, but the sort order changes. Is it possible to maintain the order of the files when a Collection is renamed?

    In my view, the bridge works correctly implemented. Kinds of collection seem to be kept in a directory UserSort that contains an index and sort sequence list files. In win 7, it's . Entries in the file index.xml include the name of the collection and point to the xml file UserSort containing manually sorted sequences.

    A workaround solution you could try: go to the UserSort/Index.xml file find your former name of collection (.filelist) and change it to your new collection name.

  • How to change the sort order of mail

    The Inbox of default e-mail to sort the order of date of id mail, with the most recent first.  Does anyone know if this can be changed and if so, how.

    Hi John,.

    Thanks for posting the question in the Microsoft Community. If I understand correctly, you are facing problems with sorting in Mail App.

    Sorting through the Mail application is by design. I suggest you to do the following to send comments:

    a. open Mail app.

    (b) or by scanning of the right border of the screen towards the center of the screen to display up to the charms bar and click settings.

    c. click on rate and review.

    If you have additional questions on the computer, please ask your question about Windows and we will be happy to help you.

    Thank you.

  • How to control the sort during the download or export

    can't figure out how to control the sort order when you export on hard drive or upload to smugmug.  have photos arranged in the way I want to do in LR and then when I export to hard drive they are ordered by file name.

    When it comes to your hard drive, your operating system determines the file order.  No matter what you do in Lightroom, the OS will be based on your choice determin how files will be ordered. If you want them to be in order, you should probably adopt a convention of name change in your export that names the exported files similarly followed by a sequence number.  File01, folder 02, etc. Then set your viewer (Finder/Explorer) to sort by file name in ascending order.

  • How can I change the sort order of the emails?

    iPhone SE 64 GB iOS 9.3.1

    When I opened my mailbox (Mail-> all inboxes) mail is currently sorted from most recent email on top, then retreating.
    How can I correct the sort order so that the oldest email is on top then go ahead?

    You have not, not in the stock email app.  Perhaps a 3rd party app offers this, but not the stock iOS app.

  • How can I change the sort order in the Photos?

    How can I change the sort order in the Photos? I would like to have more recent photos at the top of the screen instead of at the bottom.

    The view of Photos with moments and collections will be sorted always growing by date, also the album «All the Photos»

    But you can sort any other album descending by date.  Create your own album custom as smart album 'My Pictures' and the descending sort.

    File > new Smart Album

    and use the rules:

    CTRL-click the smart album in the sidebar and in this way it as you want:

    These sorting options available in Photos on MacOS X 10.11. El Capitan, but not in Yosemite.

  • How can I change the sort order in the finder / media / photos?

    When I want to open a photo in an application I can access photos via the media / photos. The sort order is ascending. I want that the descending sort order. Where can I do this? Thanks for the reply! Christian

    You can click right in the grid of thumbnails and choose to display it as a list. You can then sort the columns by clicking on them.

    I don't know of a way to get to another level by default.

  • What is the sort order used Finder?

    I did a little research on this issue and found that (unless I'm missing something), the sort order of the Finder is not what it is supposed to be.

    The only requirement that I found is this note archived tech how Finder lists items that are sorted by name (Mac OS X) from 2012.

    In fact, almost everything what he described how Finder behaves, with the exception of the note at the bottom:

    Technically speaking, the Finder sort is based on the Unicode snack Algorithm, defined by the Unicode Consortium. This standard provides an order for all characters in Unicode sorting complete and unambiguous

    And that complicates matters, since (for example) the underscore character (officially called "bass line"), which sorts upwards and so before all alphanumeric value Unicode of U005F, which lies between the uppercase and lowercase Latin letters: 'Z' is U005A and 'a' corresponds to U0061.

    The reason I ask is because I would like to find a character that sorts after all Latin characters.  Many sort to before, including < space >, stress / < low line > and (my favorite for folders) < pointing right angle double quote > (i.e. "'").

    If it was really sort by Unicode, then it would be simple to use the selector of characters to insert a Unicode character value, such as U25B9, which is "▹.  "But we sort after space <>, < low line >, and" ' ", but before all Latin characters.

    I found an abstract character who works here for this, but I am helpless about the why.  U1400 is the Unicode section called "Unified Canadian Aboriginal syllable", and U1433, the "Canadian syllable Po", is a character who appears in the Finder as a very big plus of symbol: "ᐳ." (More than the symbol is ' > ' for comparison.)

    Yes WHY?

    Why think the Finder that's good (partial) order:

    U0020 "" (space)

    U005F '_' (bass line) < underscore >

    "U00BB '" ' (pointing to the right angle double quote)

    U005C "------" (Reverse Solidus) < backslash >

    U25B7 "▷" (white triangle pointing to the right)

    U0041 "A".

    U007A 'z '.

    U1433 "ᐳ" (Canadian syllable Po)

    Note: I see that note technical I linked to refers to the "Unicode snack Algorithm", which could indicate the answer somewhere in its depths.  If this is the case, then I guess this raises the question of why the Unicode coalition choose such an unexpected algorithm.

    Your "Note" has the answer.  Sorting of Unicode is not determined by the values of code as such point, it is determined by the algorithm.  This can be quite complex, but I think an easy way of having things to sort after Latin is to use a Greek character as µ (m option).

    http://Unicode.org/charts/collation/

  • Is it possible to change the sort order of the Windows Explorer?

    When you use windows Explorer to search for files I find things I named by date are sorted incorrectly.
    Here is an example of how that fate (sorted by name, having consulted the details page): names of files in the following order

    Tidbits200710001b
    Tidbits200710001a
    Tidbits20100207a
    Tidbits20100201a
    tidbits20080300s
    tidbits20080300r

    I would like to than years (at least) to be in order.  Is it possible to change the sort order in windows Explorer?

    http://support.microsoft.com/kb/319827 :

    1. Click Start, click run, type regedit, and then click OK.
    2. Use one of the following methods, depending on your situation:
      • To configure the policy for all users of the computer, locate and then click the following registry key:

        HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
      • To configure the policy for the current user, locate and then click the following registry key:
        HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer
    3. On the Edit menu, point to newand then click DWORD value
    4. Type NoStrCmpLogical, and press ENTER.
    5. On the Edit menu, click modify.
    6. To set the order of sort that you want to use for files and folders whose names contain numerals, use one of the following methods, depending on your situation:
      • To configure Windows XP or Windows Server 2003 to use the method used by Windows 2000 for sorting files and folders, in the value data box, type 1, and then click OK.
      • To configure the default Windows XP or Windows Server 2003 method for sorting files and folders, in the value data box, type 0, and then click OK.

        Note When the NoStrCmpLogical value does not exist or it is set to 0 (zero), the Windows XP default sort order is used.

    7. Exit the registry editor and restart the computer.

    You want the first option 6.

    Noel

  • Change the sort order for symbol/button.

    I have a line of buttons (which are near eachother). When you click them they step up big.

    Problem is that the button clicked is not arranged / sorting forward and what lies behind

    other buttons next to him.

    How can I change the sort order (inside the button symbol /) when clicked?

    Hi Claursen,

    This is what I did to reproduce your scenario: -.

    1. on stage, I create a symbol, I created another symbol inside, and inside the nested symbol, I created 3 symbols and names them "btn1", 'btn2', 'btn3.

    2. now, I open the actions of the "btn1" symbol and for the click event, I wrote the following code

    var El = sym.getSymbol("btn1").getSymbolElement ();

    El.CSS ("Transform","Scale (4,4)");

    El.CSS("z-index","1");

    Similarly, I put the code for the click event handler for 'btn2' and 'btn3.

    3.now when I published the file and clicked on one of the three symols, he scaled and was visible in the foreground the other symbols.

    Correct me if this is not the scenario that you call.

    Thank you

    Sliman

  • iTunes has changed the order of songs on an album. How to restore the original order?

    I have a classic album. iTunes has changed the order of the songs. How to restore the original order?

    Order of songs is controlled by the number of drive and the beaches. Set them accordingly.

    TT2

  • How to change the tab order of an array of clusters?

    How to change the tab order of an array of clusters?  I have the cluster arranged into a table in the front panel.   The element of the cluster passes horizontal and array element passes vertically.   When I press the tab key, the cursor will move to the item next to the table instead of the next item in the cluster (down to the place overall).

    so you have an array of clusters or cluster and the separate table?

  • Windows Mail seems to change the sort order of the mail every now and then.

    Windows Mail seems to change the sort order of the mail every now and then.  I want that it in the order received, desending and back to this sometimes.

    Hi rondebmar,

    You can check out the following link and try the suggestions posted by t-4-2 on Thursday, January 7, 2010 08:57 PMand check if this may help.

    http://social.answers.Microsoft.com/forums/en-us/vistanetworking/thread/d9aa1297-1124-43e5-b463-5441f3922388

    For more information, please visit the following links:

    http://Windows.Microsoft.com/en-us/Windows-Vista/view-e-mail-messages-in-Windows-Mail

    http://Windows.Microsoft.com/en-us/Windows-Vista/check-for-new-e-mail

    Hope this information is useful.

    Boumediene. K.
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Why Lightroom arbitrarily changing the sort order?

    As I can't reach the cat, nor can I phone, nor there at - it a way to send an email, I have only a possibility and this is to publish this error on the forum.

    Lightroom CC arbitrarily changes the sort order. Sometimes after generating a panorama or modification outside of Lightroom, for example in Photoshop app ranges from the sort order 'moment of creation' to 'user defined' (I don't know the English article for this sorting options).

    This behavior of the application has been boring since Lightroom 4 and I am baffled that this still does not work. However, professionals in their workflow and it can't be so hard to fix.

    Thank you.

    Hi pentido,

    Please try to reset the preferences of LR CC

    Retrieve the catalog and images after resetting preferences

    Concerning

    Rohit

Maybe you are looking for