How to sort select highest value in column ?

Sort by
highest text value in column (name) 
example
column :  ID    name       
address  before                 ID      
name    
address  after
               1      jony          street1                               1   
   muhmuod        street3
               2       ali           street2                                2     
  jony               street1
               3    muhmuod   street3                                3     
   ali                 street2

SELECT Row_Number() over (Order by Name desc) as ID
, name
, address
from tbl
order by name desc;
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

Similar Messages

  • WAD template with BSP Application - how to read selection screen values

    Hello,
    I've created Web template with Web Application Designer (WAD).
    I would like to extend  that page with BSP Application...
    Purpuse of this application is to read some information from tables
    on BW transaction server and display them within Web page.
    Question: How to read selection screen values from a Web template ?
    Thanks for any help,
    Pawel Borowiec

    Hi,
    The selection screen parameters will be on an inputField, so try and get the is of the inputfield generated by doing View source...
    And once you get the inputfield Id, you can read the value in the InputField(InF) by
    using the following code...!
    data : if_value type ref to cl_htmlb_inputfield.
    data : variable type string.
    if_value ?= cl_htmlb_manager=>get_data( request = request
                                                name    = 'inputField'
                                                id      = 'InF_ID_here'
           if if_value->value is not initial.
             variable  = if_value->value.
           endif.
    Hope this helps.
    <b><i>Do reward each useful answer..!</i></b>
    Thanks,
    Tatvagna.

  • How to capture selection-screen values

    Hi,
      How to capture selection-screen values when user pressing F3 or Back button after the display of report.
    Regards,
    Bujji.

    Hi Bujji,
    select-option are actually ranges or more general internal tables with the structure:
    SIGN:    'I'nclusive or 'E'xclusive
    OPTION:  'EQ', 'BT', 'NE', 'GE', 'CP', ....
    LOW:     low value of type of the curresponding "FOR table-field"
    HIGH:     high value of type of the curresponding "FOR table-field"
    You may just code:
    TABLES: mara.
    SELECT-OPTIONS s_matnr FOR mara-matnr.
    LOOP AT s_matnr.
      WRITE: / s_matnr-sign,
               s_matnr-option,
               s_matnr-low,
               s_matnr-high.
    ENDLOOP.
    If you find my answer useful, please don't forget the reward.
    Regards,
    Juergen

  • How to assign select-option values to internal table

    hi all,
    how to assign select-option values to internal table
    thanks in advance.

    Hi,
    You just need to loop at your select-option field and take the values from low and high fields.
    for. e.g
    loop at s_werks .
    move:s_werks-low to <your itab>
    if not s_werks-high is initial .
    move: s_werks-high to <youritab>
    endif .
    append <your itab>
    endloop .
    OR use select statement.
    regards,
    Omkar.
    Message was edited by:
            Omkaram Yanamala
    Message was edited by:
            Omkaram Yanamala

  • How to add only highest values in the column

    Hello All,
    We have report where I need to add only highest values in 'Price' column.
    Ex:
    Group  Mat      Price
    Grp1    Mat1    50
               Mat2    75
               Mat3    100
    Grp2    Mat1    50
               Mat2    100
    I need my result as 200...
    Any input is appreciated!
    Thanks in advance !!
    Venu.

    Sriman/Surendra,
    Unfortunately, this approach does not work because the Calculate Result As --> Maximum applies not only to the subtotals but also to the grand total. Therefore, the result in Venu's example will be:
    MAX(Grp1) = 100
    MAX(Grp2) = 100
    MAX(All Grps) = 100
    We have the same requirement as Venu, but have not found a satisfactory solution yet. The only way we have solved such problems in the past is to use VBA in workbooks, but the report we are using now is a Web report.
    Hope this helps to clarify the issue...
    Bob

  • Using select list value as column name in SQL

    Folks,
    Thanks in advance for any help with this
    I have a select list with two values (Instance and Username) created by
    STATIC2:Username;USERNAME,Instance;INSTANCE
    I am trying to pass the value of this (:P2_SELECT) and use it as a column name in a SQL query as below
    select USERNAME,
    INSTANCE
    from table_name
    where :P2_SELECT like '%'||:P2_TEXTSEARCH||'%'
    When I substitue the :P2_SELECT for one of the values (either instance or username) this works fine
    I suspect it is due to how Application Express interprets the value of :P2_SELECT
    Any help would be much appreciated!
    Gareth

    Thanks Munky that worked a treat!
    The next hurdle I have now is that because I have changed the region type to "PL/SQL Function(returning SQL Query)" there is no longer the option to add sorting to the columns as I have had to change the Source option to "Use Generic Column Names (parse query at runtime only)"
    I will have a scout around and see how I can get around this
    Gareth

  • How can i select multiple values form select list

    Hi ,
    I have created few items in a page and all items are Lov items and based on these items stacked charts will display. My requirement is I need to select multiple values form LOV's
    Eg: In Interactive report goto filter and select an item and expression as IN and select multiple items and i need to select multiple values like this.
    Please anybody help me how to get multiple values.
    I have one more doubt Can we have a Print preview option in APEX.
    I have to see print preview for stacked charts. is it possible?
    Regards
    Narender B

    HI ,
    Thank you for valuable information and looks good.but Here our client need to select multiple values.... for eg: Open IR report and click on Actions button --->select filter
    select any column , operator as IN and from expression select multiple items.
    I need to select multiple values in that way so, could you please guide me how can i achieve this.
    Regards
    Narender B

  • How to sort via multi value parameter in ssrs

    I have a parameter with multi values. when the user selects ,he get of options like acount name, first name, last name.
    so if user selects firstname , the data has to sort by firstname.
    if he selects acount name , the data has to sort by account name.
    please help me how to sort the data using parameter with multivalue? in ssrs 2008.
    Thank you?

    Hi Venku,
    Based on your description, it seems that you create a parameter with available values and you want to sort the report data based on the parameter value. If the available values are the field names in the report, you can try to open the Tablix properties
    dialog box and specify the sort expression on "Sorting" tab as follows:
    =Fields(Parameter!parametername.value).value
    If the parameter allow multiple values and you want to sort the report data by more than one field, for example, sort the report data by "accountname" and then by "firstname", please add two sort expressions as follows:
    =Fields(Parameter!parametername.value(0)).value
    =Fields(Parameter!parametername.value(1)).value
    If you have any question, please let me know.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • How can i select decimal values only

    Hi,
    I have values in my column :
    1234
    123345
    1233.0
    4546.01
    how i select decimal values only (1233.0,4546.01)
    Regards
    Faheem

    Thanks,
    i run this seperatly but how these two merge :
    select COUNT(VAL)
    from test
    where val <> trunc(val)
    out put=3
    select max(length(VAL)) MVAL,VAL
    from test
    where val <> trunc(val)
    GROUP BY VAL
    ORDER BY MVAL DESC
    out put =
    9     12.199923
    6     12.223
    5     12.12
    i need out put :
    3 12.199923

  • How to convert some row values in columns

    Hello guys,
    I'm using Oracle 10g in a windows platform, I have the following data:
    with test as
    select '000-ME-001' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    select '000-ME-001' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    select '000-ME-001' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
    select '000-ME-002' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    select '000-ME-002' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    select '000-ME-002' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
    select '000-ME-003' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    select '000-ME-003' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    select '000-ME-003' tag_number, 'Capacity 350' tag_details1, '' tag_details2 from dual
    )How can I covert the values of tag_details1 as column name to achieve this result:
    tag_number     Capacity 150     Capacity 250     Capacity 350
    000-ME-001     000-TS-M-226     000-TS-M-227     000-TS-M-228
    000-ME-002     000-TS-M-226     000-TS-M-227     000-TS-M-228
    000-ME-003     000-TS-M-226     000-TS-M-227Hope you can help me, best regards.

    select tag_number
         , max (decode (tag_details1, 'Capacity 150', tag_details2))
         , max (decode (tag_details1, 'Capacity 250', tag_details2))
         , max (decode (tag_details1, 'Capacity 350', tag_details2))
      from test
    group by tag_numberas in
    SQL> with test as
      2  (
      3  select '000-ME-001' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
      4  select '000-ME-001' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
      5  select '000-ME-001' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
      6  select '000-ME-002' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
      7  select '000-ME-002' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
      8  select '000-ME-002' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
      9  select '000-ME-003' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
    10  select '000-ME-003' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
    11  select '000-ME-003' tag_number, 'Capacity 350' tag_details1, '' tag_details2 from dual
    12  )
    13  select tag_number
    14       , max (decode (tag_details1, 'Capacity 150', tag_details2))
    15       , max (decode (tag_details1, 'Capacity 250', tag_details2))
    16       , max (decode (tag_details1, 'Capacity 350', tag_details2))
    17    from test
    18   group by tag_number
    19  /
    TAG_NUMBER MAX(DECODE(T MAX(DECODE(T MAX(DECODE(T
    000-ME-002 000-TS-M-226 000-TS-M-227 000-TS-M-228
    000-ME-001 000-TS-M-226 000-TS-M-227 000-TS-M-228
    000-ME-003 000-TS-M-226 000-TS-M-227Edited by: Alex Nuijten on Jun 3, 2009 4:03 PM

  • How to get selection criteria value in method IF_POWL_FEEDER~HANDLE_ACTION

    hi:
    As you know, we could get the leading selected POWL result data through parameter  c_selected and  c_selected in this method.
    but moreever, I want to get the selection criterai values in this method too just like the paramter i_selcrit_values in the method IF_POWL_FEEDER~GET_OBJECTS, how to do it?
    I have tried to define a attribute in my POWL class and save i_selcrit_values into this attribute in the method IF_POWL_FEEDERGET_OBJECTS, but in method IF_POWL_FEEDERHANDLE_ACTION, this attribute is still empty, so this workaround failed.
    thanks.

    hi guys:
    I have founded how to do it:
    METHOD get_selcrit.
      DATA ls_query TYPE powl_query_sty.
      DATA lt_selcrit TYPE rsparams_tt.
      FIELD-SYMBOLS <ls_selcrit> LIKE LINE OF lt_selcrit.
      CALL METHOD cl_powl_runtime_services=>get_current_query
        RECEIVING
          rs_query = ls_query.
      CALL METHOD cl_powl_query_accessor=>get_cached_selcrit
        EXPORTING
          i_query     = ls_query-query
        IMPORTING
          e_crit_para = lt_selcrit.
      READ TABLE lt_selcrit WITH KEY selname = iv_selname
        ASSIGNING <ls_selcrit>.
      IF <ls_selcrit> IS ASSIGNED.
        ev_selcrit = <ls_selcrit>-low.
      ENDIF.
    ENDMETHOD.

  • How to get selected text values in a textarea by mouse click?

    Hi Everyone,
    What I am trying to do is to click on some texts in a textarea, then get the selected text value.
    If you guys have used an accounting software called Simply Accounting, you might understand better.
    I list all my customer names in a textarea. What I want is, when I click on one customer, another GUI pops up with this customer's information. My problem is that I don't know how to get the selected text value from a textarea.
    Could anyone give a hand here? Thank you in advance.

    Is there some reason you aren't using a JList or
    JTable to display
    the user names/information?Thank you for es5f2000's reply. You just gave me a better idea! There is not a particular reason I have to use TextArea to list my customers. As long as the component can make my idea alive, I definitely use it. Still, if there is any way to get a selected text value, it will help me a lot with my project. Thank you.

  • How can I set a value of column in SSIS by using Replace

    How can I set a value of a column in SSIS using a Replace in Derive columns. I have here NameCode and I need to Set = 1 Where NameCode like LIKE '____99____'
    eg. 1006993010... if 5th and 6th characters are 99
    Else 0
    Hope to hear from someone soon and I appreciate great help here.

    If NameCode column is integer then you have to cast it correctly to String.
    I am adding that to the expression provided by Rajen.
    SUBSTRING((DT_WSTR,20)ProductCode,5,2) == "99" ? 1 : 0
    -Vaibhav Chaudhari

  • How to read select-option values

    Hi Experts
    I have a requirement where in I need to provide F4 help for a parameter on selection screen for the entries in a select-option on the same screen.  Here I need to get the value of select-option and based on that I need to provide f4 help.  Please let me know if any one came across such scenario as to how we can read the values on the same screen.
    Venkat

    Here's one I used
      CLEAR d_line.
      IF s_div IS INITIAL.
        d_line-fldname = fldname.
        d_line-sign = 'Include'.
        d_line-low  = 'All'.
        WRITE:/ d_line.
      ELSE.
        LOOP AT s_div.
          PERFORM display_selection_detail
            USING fldname s_div-sign s_div-option
                          s_div-low  s_div-high.
          CLEAR fldname.
        ENDLOOP.
      ENDIF.
    *&      Form  display_selection_detail
    *       text
    *      -->P_FLDNAME  text
    *      -->P_SIGN  text
    *      -->P_OPTION  text
    *      -->P_LOW  text
    *      -->P_HIGH  text
    FORM display_selection_detail USING    p_fldname
                                           p_sign
                                           p_option
                                           p_low
                                           p_high.
      CLEAR d_line.
      d_line-fldname = p_fldname.
      CASE p_sign.
        WHEN 'I'.
          d_line-sign = 'Include'.
        WHEN 'E'.
          d_line-sign = 'Exclude'.
        WHEN OTHERS.
          d_line-sign = p_sign.
      ENDCASE.
      CASE p_option.
        WHEN 'EQ'.
          d_line-option = 'Equal'.
        WHEN 'NE'.
          d_line-option = 'Not Equal'.
        WHEN 'BT'.
          d_line-option = 'Between'.
        WHEN 'GE'.
          d_line-option = 'Great Than or Equal'.
        WHEN 'LE'.
          d_line-option = 'Less Than or Equal'.
        WHEN 'GT'.
          d_line-option = 'Great Than'.
        WHEN 'LT'.
          d_line-option = 'Less Than'.
        WHEN OTHERS.
          d_line-option = p_option.
      ENDCASE.
      d_line-low  = p_low.
      d_line-high  = p_high.
      WRITE:/ d_line.
    ENDFORM.                    " display_selection_detail

  • How to pass select option value to function module while using service call

    Hi,
    I have select-option in my WD application. To collect data based on user input im using service call. How to pass this select option values to my RFC.
    rgds
    sudhanshu

    Hi,
    Thank s for your reply. In fact im doing similar with following variation:
    i) collected range values using get_range* method.
    ii) separate low and high values as: 
    read table <field2> index 1 into wa_range.
    vert2_low = wa_range-low.
    vert2_high = wa_range-high.
    (Please note that in RFC I have taken two importing parameter as s_vert_lo and s_vert_hi)
    iii) Now setting these RFC attribute as:
    lo_el_importing->set_attribute(
        EXPORTING
          name =  `S_VERT_LO`
          value = vert2_low ).
    and
    lo_el_importing->set_attribute(
        EXPORTING
          name =  `S_VERT_HI`
          value = vert2_high ).
    iv) In RFC im having my query as :
    select <fld list> from BUT000 into table itab where vertical in r_vert.
    Here, r_vert is a range defined as:
    ranges r_vert for <fld refrence>
    r_vert-sign = 'I'.
    r_vert-option = 'BT'.
    r_vert-low = S_VERT_LO.
    r_vert-high = S_VERT_HI.
    append r_vert.
    Issue here is with ranges. if im passing both low and high values it is fine but if only low value being passed it is not giving me any record.
    Please suggest.
    Rgds
    Sudhanshu

Maybe you are looking for

  • How do I transfer data from an IOS 7 iPhone 5 to an IOS 6 iPhone 5?

    I missed the cutoff for reverting to IOS 6 via iTunes, so in desperation I just bought an iPhone 5 with IOS 6 on it. (I have a vestibular disorder that leads to feeling very carsick when I use the phone, even with Reduce Motion on.) My last iTune bac

  • Receiver MAIL adapter setting

    Hi ALL, I have a receiver mail scenario .. In the mail adapter u2026There is a option Connection Parameter for mail server..And Configure User Authentication u2026I just have the mail idu2019s of the receiver u2026Is there any setting to be done by B

  • Git Protocol Usage With TFS 2013

    In our organization we have been using TFS for some time. Recently we have had a set of developers building internal tools to be consumed by various parts of our engineering teams to help with our developing or product. These developers used a local

  • White marks on the back?

    Iv had my iPhone 5 in a case ever since I got it but it's now got little white marks on the back, any info on how to remove them?

  • Appleworks won't launch anymore

    I click on the icon and it just bounces and then stops. 1) I emptied my recent items folder 2) dragged the applworks icon from the dock to the desktop and then reinstalled it from the finder/applications section onto the dock To no avail and I can't