Random order by SQL!

31%

Hello

I had posted this query in the request forum, but I guess that it really should have been posted in this forum, since its more of a question of sql. Apologies if it's against the forum rules.

We have a camembert in Application Express which was select as

Select null, ' 0-10' days, count (*) table

Union

Select null, 11-20' days, count (*) table

Union

Select null, 21-30 days, count (*) table

Union

Select null, ' > 30' days, count (*) table

The 3d pie chart showed the slices is the right order 0-10, 11-20, 21-30, > 30 but now it shows in a random order.

Unfortunately, the tables of Apex have a restriction in the select statement is, he should just have three values in the select statement, the first is a link (can be null), the second can be any column_name or description and the third a value such as count, sum, etc.. Now, the above query is to count the number of sales in number of days mentioned and so what happens is that it takes values as character of sort and I think that sort randomly in the graph of the apex. Now, this works very well in SQL! So I was wondering if anyone has any suggestions on how to maybe force the sort on the second column (0-10, 11-20 etc.). If I take these values as 010, 1120, 2130 3000, something like that (essentially a number) it seems to work very well, but then these see the towards the top shape of labels on the map which is not correct.

Any suggestions on how to get the work order. I have printing since the days in the select column is a column of characters, that this problem occurs, however, with restrictions on the number of items that we have in the charts of the Apex, just wondering how do you get the work order?

Thank you

Ryan

Something like that? : - (used the emp table just for reference)

SQL > select email, substr(days,2) days, cnt
2 starting at)
3 select send null, to_char (1) | ' 0-10' days, cnt count (*) of the emp
4 union
5 Select to_char (3) null, | "21-30' days, count (*) of the emp
6 union
7 select to_char (4) null, | "> 30' days, count (*) of the emp
8 union
9 to_char (2) null, select | "11-20' days, count (*) of the emp
10 order by 2
11)
12.

E DAYS CNT
- ----- ----------
14 0-10
11-20 14
14 21 - 30
> 30 14

Thank you!

Tags: Database

Similar Questions

  • Sort in random order

    Nice day

    I just want to know how can I sort my record set in a random order. That means I want a sql like statement

    Select * from customer

    to produce differently to sort the results.

    Kind regards

    Something like:

    select * from customer order by dbms_random.value;
    

    SY.

  • I have created a slideshow using Photos app. I wish that the images will appear in a random order (as they can in Power Point). I see no way to do it in the settings. Any advice?

    I have created a slideshow using Photos app. I wish that the images will appear randomly (as they can in Power Point), but I don't see where in the settings that allows this. Any thoughts?

    There is no option in Photos for MAc that allows you to randomly pull a slide show.

    You can create an album and have the album as an instant slide show in a random order using an Apple Script.

    See this link: Script: Shuffle Photos for an instant slide show in a random order

  • How can I cerate a table with a set of numbers saying 1 to 12 random order but no recurrence.

    How can I cerate a table with a set of numbers saying 1 to 12 random order but no recurrence.

    I know it should be easy, but my brain doesn't work right now


  • How to set the digital image to display photos in random order on a picture frame digital df730

    My digital photo frame displays photos in sequential order. How can I change in a random order?

    I solved the problem. Photo selection and then pressing the key on human beings to control hand symbol to the top of the configuration menu.

    Then, I could choose slide show with shuffle. Unfortunately the user guide does not explain this, or online information.

  • Sidebar gadgets are in random order each time I restart the application from the sidebar or I restart the computer.

    For some reason, whenever I restart the computer or I close the application of the sidebar and re - open in the start menu, my gadgets are in random order.

    I saw another thread for this on Microsoft Answers Social, but his problem was just after installation of SP2. I had SP2 for a long time and recently began to experience this.

    A moderator of Microsoft support proposed making sure that Java and Flash have been fully installed and implemented to date. I have both.

    However, due to a recent achievement in the platform of Adobe Flash (the one that allows the remote control, discovered last week), Adobe has proposed the Flash upgrade to the release candidate 7 (10.1) version. What I did. Could that be the cause? Hope not. If this is the case, then I will be happy to downshift until a solution has been found. However, the Java platform is perfectly updated and operational. And it's the 6.20 version, which is the latest public version.

    Well, I reformatted my hard drive and all restore factory settings.

    Everything worked fine... Until I installed again my Adobe CS5 Master Collection.

    So I started uninstalling the components one by one to see what worked...

    It turns out that Adobe Acrobat 9 Pro Extended (or rather the 64-bit extension him) makes the sidebar go haywire.

    Uninstalled Acrobat 9 and no problems yet. Restarted several times to make sure.

    I hope that one day I'll find an update to Acrobat who sets. Maybe I'll go post in the Adobe forums for that one.

    Whatever it is, no biggie for me - I barely use Acrobat.

  • in newly improved LR6.4, when I want to import from SD card, the images are in a random order, not the order that I pulled on them.  Images are scattered.  Once imported, the images are correct. How can I get the import to be in the order that I pulled on

    in newly improved LR6.4, when I want to import from SD card, the images are in a random order, not the order that I pulled on them.  Images are scattered.  Once imported, the images are correct. How can I get the import to be in the order that I pulled on them?

    Is there a sort option near the bottom of the import screen. Have you tried different sort options that are available?

  • Script to renumber the links in random order

    I have Chapter 1 page with 50 small photos in a very Orthodox and symmetrical grid should I repeat in a different random order for other chapters.

    Links have a logical syntax numbered like:

    pict1. TIF

    PICT2. TIF

    etc.

    For Chapter 2, the idea is to repeat the first but in a random order. Same photos, same layout, different order.

    Perhaps a script could rename the links?

    Thus, once the folder is duplicated, I'll have a second folder:

    Photo 1. TIF is now, for example, pict45.tif

    Picture2.tif.is now, for example, pict13.tif

    etc.

    IF I recreate a link to a copy of Chapter 1 of this second issue perhaps the idea could be resolved.

    Jarek, salvation.

    It works when it's only ONE image per page.

    But, with lots of photos on the page, as in the example, the script is dead.

    (no error at all)

    I have six pages with the same grid of images repeated in a file.

    The idea is that, at 2, 3, etc., the script changes the order randomly have different positions.

    I have tried various combinations but were useless.

    Thank you.

    PD. The screenshots show the script works with simple images.

  • View all items from web application in random order

    I see that it is possible to display an element of web app randomly, what about all the web app items in a random order?

    Your loading a lot of content but this way you don't want to and can be indexed by the search engines when you won't. It will appear as consistent all the elements and not random content fresh.

    While this is not ideal for search engines, you can have a page and all web applications using tag counter in the elements for each you can do which cache of search engines. You are running then through these with tell jQuery to choose a random set and Ajax in to where you want.

  • Can I fix? My custom paper sizes are displayed in a random order!

    I use 2 CS on a Mac.  I created about 40 custom paper sizes.  They appear in a random order on the menu drop down.  Is this normal and is there a way to organize them?

    Thanks for any help.

    Yes, the enumration of the custom page formats are controlled by epson driver.

    Thank you

    Florian

  • Loading of several video Clips in random order

    I have a flash file that loads video clips at random. The code below is the Framework 1. I have a gotoAndPlay at the end of the timeline to start over so it allows to scroll all the clamps instead of playing one. I don't think that this way is really the best way to do it... but that's what I have so far. Ideally what I need to do, is have it Browse clips in random order, preference not to resume until he got through them all, but at least don't play is not the same one twice in a row. Any suggestions are greatly appreciated.


    Suggestions were very helpful. Thank you! This is the code that we ended up using it. This code was part 1 and forces us to a loop by putting a gotoAndPlay (1) at the end of the main timeline. I don't know why he did that but it didn't work without it.

  • Retrieve the random record from SQL and also an ORDER

    I need a query that is able to get X amount of random records from a database of SQL2008, but I also want those results to then order by a field in the same table numberic, camp_priority

    I have

    SELECT TOP #DisplayAmount #, camp_uid, camp_title, camp_text, camp_image_type
    Campaigns
    WHERE camp_uid IN

    etc... etc.

    then, at the bottom, I

    ORDER BY newid (), camp_priority

    The problem seems to be that I'm random records, but it is not ordered by the camp_priority

    Anyone have any ideas?

    Thank you

    Mark

    Hey Adam,.

    I misread your original post, now I see how it was supposed to work, just posted below... got it works... works very well. If all goes well, is not to kill the CPU that this query will use a LOT... I'll just take a plu ;-) CPU

    Regarding the performance of NEWID() issue, I do not have a specific link, I was just hunting around different forums etc and found a few posts that talked about performance issues and who had a command I never saw that took a percentage of files with a lot of perfomance test graphic showing it was 10 times slow the other approach.

    I'll just have to see how it goes

    Thanks for the help

    Mark

  • Random selection in SQL query

    I have a query or SQL, I write when I need to select the records in this way.
    More than these 2 folders and 2 files for each user name should be random.
    There are a lot of areas I get through my SQL; but the username there are usually around 20 unique user names.
    The data itself without random statement be added return about 2000 discs.

    If someone could help me with the syntax of the SQL portion that could achieve the results I'm looking for, I would appreciate it.
    I've never tapped into before random selection method.
    Someone told me I could use a rank() statement; but I have no idea how to use it.
    Then, someone else mentioned to use dbms_random.value which is another that I don't know how to use.

    Please let me know if you have any ideas that could help me.

    Thank you

    my request has just need a slight modification:

    SQL> select   deptno, ename
      from   (select   deptno, ename, row_number () over (partition by deptno order by dbms_random.value) rn
                from   emp)
     where   rn <= 2
    
        DEPTNO ENAME
    ---------- ----------
            10 CLARK
            10 KING
            20 JONES
            20 ADAMS
            30 MARTIN
            30 JAMES     
    
    6 rows selected.
    

    in my case deptno plays the role of your users!

  • 10 IOS includes discussion messages in apparently random order.

    Given that the e-mail update of IOS 10 wires on my iPhone 6 + appear in a weird order. There seems to be no real order to the way messages are displayed once you click on the thread.

    The first message in the thread seems to be randomly placed in some of the answers, and sometimes the entire thread will be one of the answers as if message breaks were not detected.

    I activated the "most recent posts at the top" setting which meant the last message and your entry point for the thread is at the top (rather than in the middle of this setting is off), but the order of the messages still quirks above.

    The question is the same in my Office 365 and Hotmail mailbox.

    I agree with you.  I'll have 20-30 e-mails in a thread and they are involved. Makes use of the impossible iPhone for e-mail management. I hope apple gets this resolved soon.

  • Load of gadgets in a random order after installation of the Vista SP2

    I have two Vista Home Premium 64 PC, one with an Intel Core 2 Quad CPU and the other an AMD Athlon 64 processor. Since the update SP2 of Vista, PC AMD load randomly gadgets when loading of account user or administrator, then the Intel PC continues to load them in the right order.

    I followed some discussions on issues like, particullarly just after the update was released, but have found no solution was offered this job. Don't back to SP1 makes no sense when SP2 works fine on both my PC except for this one problem. I remember as part of SP2 improvements in the effectiveness of Gadgets and believe that service pack may have been buggy. There is no other anomalies that occur on a PC.

    Is anyone aware of a fix for this? Before SP2, I think I'll stop Gadgets and try gadgets Google or Yahoo, if it cannot be resolved.

    Note first of all, what about placing the elements not anchored where they would be so grounded. This would be simply place the items on the desktop in the sidebar, that would show them so low place on the screen below anchored points, but you'd have a dickens of a time access without closing the sidebar. With lots of gadgets, those anchored would cover those under the box. Nice thought, but not a practical solution.

    Now, as I left the thing alone for a few days, I have connected at the start of this suggestion and noted that the gadgets that I had left at the dock were in the same position when I finally logged, as well as the posted items. It was the first time that they had not scrambled. So I closed and then reopened the sidebar, and they maintained the position. I moved their autour, closed, and then reopened and the same thing, everything remained in post.  So I have carefull brought all but two gadgets, I was wondering if when they move some on the second "page" if it left the jostling. But again, all is well in the sidebar. So I disconnected and turn it back on, and they are perfect. Even with a reboot and a connection, all of a sudden, everything is back to normal and the sidebar is to remember where everything was.

    I have not checked to see if there was a Windows Update today which may have addressed, but otherwise I did correct it, it just fixed itself! For me, this issue is closed.

Maybe you are looking for

  • Shortcuts do not work and open with box appears after the virus

    None of my shortcuts work, a box to choose which program you want to use to open this always appears. The only way to open a program is to right click and select the administrator rights. Had a problem with a virus, it has been removed with norton 36

  • Legitimate Windows

    I use a gateway SX2803-53 and my software is now in limbo after the following. I spent the month of July of the House and for this period, my computer has been disconnected from all power. Return and on start-up Windows 10 the computer refuses to sta

  • Download of OME

    Greetings It seems that all the links to download OME point to https://marketing.dell.com/dtc/ome-software It seems that there is a problem with the site that once information is provided the link to actually download the software is dead. Did anyone

  • A matter of design about the update of a screen of classes different all in now the lock of the event.

    I have a screen: A class that extends the screen I have three Classes that contain a call to a database that returns records of ~ 50 that I fill a ListField with. The ListField is added to a different Manager according to the class A class that conta

  • Import of schemas and tables of RMAN backup

    Hi allI have here are 3 requirements:(1) is it possible that I can import a single table using RMAN backup, because I have no more than one day of EXPDP dump file and the requirement is to store the data of three days.(2) is it possible that I can im