Select by specified order

Hi,
In the table, (testtable). That are contain pair values var -> num : a - > 1, b -> 2, c -> 3 .......... z ->26 .
I want to select var from testtable by specified order by
num in (1,3,5,2) the var order to be a,c,e,b
num in (5,4,3,2,1) the var order to be e,d,c,b,a
But the result is not!
Is there a way to select vars by specified order by num field?
Thank you!
Francis SZE
SQL> desc testtable;
Name                                      Null?    Type
VAR                                       NOT NULL VARCHAR2(20)
NUM                                       NOT NULL NUMBER
SQL> select var from testtable where num in (1,3,4);
VAR
a
c
d
SQL> select var from testtable where num in (1,3,5,2);
VAR
a
b
c
e
SQL> select var from testtable where num in (5,4,3,2,1);
VAR
a
b
c
d
e

SQL> with sample_table as (
  2                        select level num,chr(ascii('a') + level - 1) var from dual connect by level <= 26
  3                       )
  4  select  var
  5    from  sample_table
  6    where num in (1,3,5,2)
  7    order by case num
  8               when 3 then 2
  9               when 5 then 3
10               when 2 then 4
11               else num
12             end
13  /
V
a
c
e
b
SQL> SY.

Similar Messages

  • Extremely slow when clicking the Specified Order - New button.

    Post Author: cavenger
    CA Forum: Charts and Graphs
    I often use the specified order option on charts to group pieces of information together. When I click the New button for a new specitied order or if I try to edit an existing specified order, it takes forever for the dialog to come up. I have experienced this problem in both Crystal 9 and 10 installed on different machines. Is there some sort of option I am missing? Maybe something that tells it to query the database. I have no idea why it would do a query at that point, it is not like I am using a select list of options from a drop down where it would need to retrieve the values. The reason this is a problem is that it takes me forever to run reports when I am asked to an add hoc report that requires this sort of customization. VERY frustrating....TIA for all help.

    Post Author: RichardN
    CA Forum: Charts and Graphs
    I'm having the exact same problem.  I think what's most infuriating about this is after waiting several minutes for the "Specified Order" Tab to display, I have to wait several more minutes after I click on the New button.  This happens everytime I click the New button, and I have eight groups to create. 
    I'm using Crystal Report XI Release 2 on Vista with 2 GB of RAM trying to access a Progress database using an ODBC connection. 
    Is there ANYTHING I can do to speed this up?  Is it possible to use the "Formula Editor" to essentially write out the information the Group Options window is creating?
    Thank you,
    R

  • Select with a order by option

    Hi all,
    I have this table
    create table TEST_ORDI (
    CODI_ORDI number(2),
    NUME_AVVI VARCHAR2(6),
    NUME_COLL VARCHAR2(6) )
    where field COLL can be null or the reference of one value of AVVI.
    For example, I've got those values
    insert into test_ordi values (5,'C9998',NULL);
    insert into test_ordi values (5,'C9999',NULL);
    insert into test_ordi values (6,'C10000',NULL);
    insert into test_ordi values (6,'C10001',NULL);
    insert into test_ordi values (6,'C10002',NULL);
    insert into test_ordi values (6,'C10003','C10000');
    insert into test_ordi values (6,'C10004','C10000');
    insert into test_ordi values (6,'C10005','C10000');
    insert into test_ordi values (6,'C10007',NULL);
    insert into test_ordi values (6,'C10008',NULL);
    insert into test_ordi values (6,'C10009','C10000');
    insert into test_ordi values (7,'C10010',NULL);
    insert into test_ordi values (7,'C10011',NULL);
    The problem is, that I must extract them like the result is, (where with "*" I've noticed the records that aren't in a order of field NUME_AVVI)
    5,'C9998'
    5,'C9999'
    6,'C10001'
    6,'C10002'
    ****6,'C10000'
    6,'C10003','C10000'
    6,'C10004','C10000'
    6,'C10005','C10000'
    ****6,'C10009','C10000'
    6,'C10007'
    6,'C10008'
    7,'C10010'
    7,'C10011'
    Notice that I must respect the NUME_ORDI like a first element of order by, and the NUME_AVVI like a second element of order by.
    It's possible?
    Thank's
    Paolo from Madrid

    Best I can come up with, assuming that your requirement is to keep rows with a nume_coll just below the row with the corresponding nume_avvi is:
    select * from test_ordi
    order by codi_ordi, nvl(nume_coll, nume_avvi), nume_avvi
    CODI_ORDI     NUME_AVVI     NUME_COLL
    5     C9998     
    5     C9999     
    6     C10000     
    6     C10003     C10000
    6     C10004     C10000
    6     C10005     C10000
    6     C10009     C10000
    6     C10001     
    6     C10002     
    6     C10007     
    6     C10008     
    7     C10010     
    7     C10011     It doesn't match your original order though, because as already mentioned, you haven't specified the rules for that particular order.

  • Specified Order Grouping does not show if Distinct Count is Zero

    Post Author: Hieu
    CA Forum: General
    Hello,
    I'm using Crystal Reports XI R2 with SQL data source. I have a cross-tab report with grouping in specified order. It's a report of applicants applying to a college. The grouping is of various majors (degrees). The report summarizes (distinct counts) the number of applicants for the groups of majors. The problem is that if the count for a group of major is zero, then that Named Group does not appear at all in the cross-tab report. I want the Name Group to appear with the count of "0".
    I notice this same phenomenon with specified order grouping anywhere and not just in a cross-tab. I have tried changing "convert database/other null values to default" but nothing working yet.
    Any help will be most appreciated. Thanks.

    Post Author: synapsevampire
    CA Forum: General
    It's not a phenomenon, it's how databases and SQL works.
    You didn't get any rows back for those with a zero distinct count (otherwise the count would be 1 or more, right?), so Crystal doesn't show any data for those groups.
    So to display a zero for those that do not exist would reuire either advanced SQL, or manual summaries.
    One method for manual summaries is to use Running Totals. Select distinct count of the applicants and group by the majors, then in the evaluate use a formula place:
    {table.majors} = "Blah 1"
    Creating a seperate Running Total for every group and replacing "Blah 1" with the various majors.
    -kai

  • Can implement the function of  "specified order " in other way?

    Version:CR2008
    usually we do ti like this:
    select :change group-->in specified order,then New a group ,and New some conditions.
    When having more then 20 specified group ,and each specified group have more then 10 conditions,this work then takes a lot of time and become hard to maintain.
    can it be implement by coding or other ways?
    thanks a lot.

    You may be able to use a formula with a Select/Case to define your group names.  After that you could use the Specified order on the resulting groups.  Here's an example I use to group minor offices into major offices:
    Select({MR0017E.OFF_DESC})
    Case "DDO":"DDO"
    Case "LDO":"LDO"
    Case "PDO":"PDO"
    Case "Pville One Stop CWS":"PDO"
    Case "PDC-Prof Dev Center":"PDC"
    Case "Visalia Adult Clinic":"TCS"
    Case "Hillman Hlth. Center":"TCS"
    Case "Hillman Annex":"TCS"
    Case "Mental Health Vis.":"TCS"
    Case "Dinuba Health Clinic":"TCS"
    Case "Vis. Health Clinic":"TCS"
    Case "Fam Hlth Care Netwk":"TCS"
    Case "KDH":"TCS"
    Case "Tulare District Hosp":"TCS"
    Case "Porterville Clinic":"TCS"
    Case "Sierra View Hospital":"TCS"
    Case "Pville Fam Hlth Ca":"TCS"
    Case "Lindsay Hlth Center":"TCS"
    Case "TWORKS Cherry St.":"TCS"
    Case "Ivanhoe FHCN":"TCS"
    Case "Goshen FHCN":"TCS"
    Case "Woodlake FHCN":"TCS"
    Case "Cutler / Orosi FHCN":"TCS"
    Case "Tulare Health Clinic":"TCS"
    Case "TDO":"TDO"
    Case "Tulare CWS":"TDO"
    Case "TPC":"TPC"
    Case "TPC Bldg A":"TPC"
    Case "VDO":"VDO"
    Case "Visalia WID":"VDO"
    Case "South Mooney":"VDO"
    Default:"Other"
    Hope this helps.
    Eric

  • Grouping by specified order question

    I have CRXI. I have a group by specified order setup discarding others. In the page header I want to count all data, including the items I have discarded that don't meet the group parameters without displaying them. How would I accomplish this.
    Ralph

    You can statically add the where clause like this
    (select count(`Customer`.`Country`) from `Customer` where `Customer`.`Country`='USA')
    but unfortunately SQL Expressions doesn't support formula fields and parameter fields in it.
    Regards,
    Raghavendra

  • Is there a way to "mix" the nodes and leaves of the tree so if they are at the same level, they will display in a specified order.

    Is there a way to "mix" the nodes and leaves of the tree so that even if they are at the same level (1,2,3...), they will display in a specified order (via sort sequence, alphabetical, etc.).
    History:
    We are using the Tree UI element to display/manage a material bom interface. We seem to be running into an issue with displaying the nodes/leaves of the tree.. regardless of the order that the context is built (which is currently the order of the exploded BOM from from CS_BOM_EXPL_MAT_V2), the bom is displayed with the nested boms at the top of each level and the single materials below them. For example. If  TK1 contains Material1, Material2, Material3, Kit1(containing component1, comp2, comp3), Material4, Kit2(containing comp4, comp5, comp6), and Material5 (in this order), the tree will display with the A level node as TK1, the next node as Kit1 (with its subleaves of comp1,comp2,comp3), Kit2(with subleaves of comp4,comp5,comp6), THEN Material1, material2, material3, material4, material5.  Our users are adamant about the items displaying in the correct order (which should be alphabetical based on the description for one report and by location for purposes of inventory for another). I've searched but not been able to locate a similar question. If I've missed it, please point me in the right direction. The users want the tree,  not a "tree" table.  This is our first attempt at the tree, so maybe we're missing something basic?
    TK1
    -Mat1
    -Mat2
    -Mat3
    -Kit1
    --Comp1
    --Comp2
    --Comp3
    -Mat4
    -Kit2
    --Comp4
    --comp5
    --comp6
    -Material5
    displays as
    TK1
    -Kit1
    --Comp1
    --Comp2
    --Comp3
    -Kit2
    --Comp4
    --Comp5
    --Comp6
    -Mat1
    -Mat2
    -Mat3
    -Mat4
    -Mat5

    co-workers said example picture is misleading.. we can make the order work if everything is a "folder" but not a mix of "folders" and "files" (if making a visual reference to the windows browser). i.e - a file is represented as an empty folder.
    TK1    
    . Mat1
    . Mat2
    . mat3
    > kit1   
    .. comp1
    .. comp2
    .. comp3
    . mat4
    > kit2
    .. comp4
    .. comp5
    .. comp6
    . mat5
    displays at
    TK1
    > kit1
    .. comp1
    .. comp2
    .. comp3
    > kit2
    .. comp4
    .. comp5
    .. comp6
    . mat1
    . mat2
    . mat3
    . mat4
    . mat5
    we can make it work if everything is a folder. This is our current workaround.
    TK1
    > mat1
    > mat2
    > mat3
    v kit1 (when expanded)
    .. comp1
    .. comp2
    .. comp3
    > mat4
    > kit2 (when not expanded)
    > mat5

  • BAPI_ALM_ORDERHEAD_GET_LIST to select two different order at a time (urgent

    hello all ,
    Using BAPI_ALM_ORDERHEAD_GET_LIST i want to select two different orders at a time . As we do in IW38 using select single vaules(1) .
    i want to know how to pass the selection .
    Up to know i have tried like this :
    FIELD_NAME                     S OP LOW_VALUE
    OPTIONS_FOR_ORDERID            I EQ 500460
    OPTIONS_FOR_ORDERID            I EQ 500400
    But i am getting only the first order . But i want both order numbers .
    So please help me on this .
    Thanks are regards ,
    Prem

    Just for information. The following IT_RANGES fields map to the IW38 checkboxes at the top of the selection-screen:
    SHOW_DOCUMENTS_IN_PROCESS      IW38 - Outstanding (CRTD)
    SHOW_OPEN_DOCUMENTS                  IW38 - In process (REL)
    SHOW_COMPLETED_DOCUMENTS       IW38 - Completed (TECO and CLSD)
    SHOW_HISTORICAL_DOCUMENTS       IW38 - Historical
    If you want to select TECO/CLSD orders, then you would use the following in IT_RANGES:
    SHOW_DOCUMENTS_IN_PROCESS      I EQ
    SHOW_OPEN_DOCUMENTS                  I EQ
    SHOW_COMPLETED_DOCUMENTS       I EQ X
    SHOW_HISTORICAL_DOCUMENTS       I EQ
    As you then said, you need to filter out the CLSD statuses using:
    OPTIONS_FOR_STATUS_INCLUSIVE I EQ TECO
    I suspect this would be a more efficient way of selecting the data, but you'd need to check.
    PeteA

  • US localization. Select 2 Sales orders in one down payment invoice

    US Localization.
    I need to create a Sales Down payemnt invoice selecting 2 sales order but is not possibile to select more than one SO.
    In Other localization I see that it is possible.
    There is some set up or on the US localization it is not possible?
    Thanks

    Hi,
    Is it was happening for one customer or all? Please check SAP note:
    1649125 - LOC_US/CA_Impossible to base a foreign currency down
    payment on multiple orders
    1766588 - LOC_US_CA_System Exchange rate cannot be used in A/R
    Downpayment Invoice
    Thanks & Regards,
    Nagarajan

  • Automatic Selection for Combination Order Creation

    Hi
    We are working with MTO scenario where production orders are created against sales order. Production orders will be combined for common items from two sales orders. We have activated the SAP MILL Products DIMP, for this functionality.
    But in MILL_OC, we need to manually input the production order numbers, which we want to combine. Our client's requirement is that the system should select the production orders of common items and combine them automatically (Input will be only 2 Sale order numbers)
    As per below mentioned link, it is possible using a function module MILL_OC_ORDER_MERGE.
    http://help.sap.com/erp2005_ehp_05/helpdata/EN/d2/c79af5651811d385db0000e8200b4c/frameset.htm
    What we are not able to understand is the input required for this FM. Can anyone help?
    If not this, is there any other way, to achieve, automatic selection & combination of common item production orders?

    Hi
    We have resolved this problem by creating a BDC.
    Thread Closed.
    Edited by: OmKarP on Nov 19, 2011 7:49 AM

  • Partner selection at sales order entry: ship-to's flagged for deletion

    Hi All,
    I need some inputs for the following issue.
    For Partner selection at sales order entry level: ship-to's flagged for deletion are also proposed as it is entered in customer master. I dont want to delete the ship-to's marked for deletion in the customer master.
    In short - only the ship-to's that are not marked for deletion should get populated.
    Kindly suggest if there is an userexit for the same.
    Regards
    KCB

    Hi,
    You can try Blocking option for the particular Ship to Party.
    But this will not disable it appearing in the Partner Function Selection Pop up.
    Once you block it; though it appear in the selection pop up, you cannot select & proceed, as it gives a error message.
    You can set this block in 2 ways.
    1 - Tx: XD05
    Go to the Tx give the customer number, sales area & Pres enter.
    There you can set different type of blocks depend on your scenario.
    Save
    2 - Tx: XD02
    Go to TX, Give the Customer number (Ship to Party) & go in. Since you have marked him as a delete, you'll get a warning message there too.
    Select Menu option -> Extras -> Blocking Data
    You'll coime to the same screen as above.
    Maintain relevant blocks & Save
    Check whether it satisfy your requirement.
    Best regards,
    Anupa

  • Selection screen fields order in report painter report..

    hi experts,
    i have a  problem with selection screen fields order in report painter report.
    Actually in report painter report selection screen order is different compare to report writer report selection screen.
    how should i get the same selection screen fields order For  Report painter  report compare to Report Writer report ?
    For example, Report Writer selection screen order is:
      ledger:
      company code:
      period:
      current fiscal year:
      previous fiscal yer:
      previous quarter end period:
    where as Report Painter selection screen order is:
      ledger:
      previous fis year:
      current fis year:
      company code:
      period:
      previous quarter end period:
    please help me regarding with this.
    Thanks and Regards,
      NAGARJUNA.

    hi nagarjun,
    Go to Sq01, select the query and goto to change mode.go to the next screens till u reach Selection fields. Here u enter the NO field in the sequence which u want ot appear in the selection screen and it is done. Save and execute.
    Ex:
    Selection fields No
    Exclude Cancelled Lots 5
    Material number 1
    Plant 2
    Material type 3
    Inspection Lot Origin 4
    Regards,
    Lokesh

  • Sequence Selection in Production Order

    Hi All,
    I am having following problem related to the sequence selected in production order...
    In my scenario there are multiple sequences in a routing for a material.In the production Order Type I have made setting of manual selection of sequence while creation of production order.When I create production order the system ask for selection of the alternate sequence and after selecting the alternate sequence the system copies all the data related to that sequence <b>But</b> when I go and see the operation overview the system still displays the standard sequence. How can I correct this problem because when I am doing confirmation the system throws error message than the standard sequence 0 does not exist.
    Please help me correct this problem.
    Regards,
    Anup Dubey

    Hi,
    As i have mentioned the system is asking me select alternate sequence it means that the tick is there.
    Please lemme know why the system is displaying the standard sequenec in operation overview though all the details related to operation are of alternate sequence.
    Regards,
    Anup Dubey

  • Why can't I select shuffle slide order in my settings?

    Why can't I select shuffle slide order in my settings. . . I see it there as an option, but it won't let me choose it.  I don't want to manually shuffle 329 slides!

    It's only available in slideshow that are generated from a album.  There you can select the Shuffle checkbox.  You can also save the settings for that specific album to be used on any set of photos that you might put in there.  Name the album something like Slideshow and reuse it.  Just remove the last batch of photos from it and add the new ones.  That will save you having to set all of the settings each time or just one setting like music.
    OT

  • How do I access specified order options programmatically?

    Using the RAS SDK (or any other .NET API), is it possible to access the specified order options of a group? I am talking about the named groups with specified conditions.
    I have found nothing when searching through the documentation, but maybe I am overlooking something. I know this used to be possible with the crpe32.dll - is it no longer possible?
    Thanks in advance!

    Hello, John;
    You can access the GroupOptions throught .NET RAS. Here is a link to the Developer Library section on groups:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RAS_SDK/rassdk_net_doc/doc/rassdk_net_doc/html/raslrfCrystalDecisionsReportAppServerDataDefModelGroupClass_MembersTopic.htm
    There is a sample of Group and Group sort code in the "VB .NET How To Samples" at:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RAS_SDK/sampleList.htm
    Elaine

Maybe you are looking for

  • How to setup a 'duplicate/mirror view' with a different zoom level?

    Hi Photoshop Gurus, I constantly keep zooming in and out of the same images. It drives me crazy to view it at normal zoom level and zoom back into deep pixels. Is there a way so that I have a duplicate floating window/view that shows realtime editing

  • How to keep a table "header" stuck at top of each page

    Okay. This will probably be impossible to explain, but here goes. I have a document template that consists of a table (4 columns and variable number of rows depending on the content). I would like the columns to have their "headers" (meaning here the

  • Is it possible to upgrade the bluetooth module in a 2011 macbook pro to 4.0?

    I have a 2011 macbook pro and I heard that handoff only works on bluetooth 4.0. I have no interest in using a dongle, so I wondered if i could jut replace the bluetooth module in my computer. Thanks

  • IPOD touch - volume!!! Help

    Hi, I am getting no volume on my speakers unless i use the headphones, when i view videos on youtube there is no volume, on my settigns i have volume as both. Can someone please help me

  • Can not open or delete palm desktop

    For about a week, I have not been able to open Palm Desktop 6.0. An error message states "application failed to start. Could not find UserData.dll" I tried reinstalling and deleting the application, but it fails withe message "failed to load DLL:HSAP