How to select unique 100 accounts

I have a sub_accont table associated with account. An account number can have multiple sub_account associated with it. How do i get unique 100 accounts. An account can be active or suspended (A or S).
I am trying the following query:
select distinct(s.account) from s.sub_account where s.sub_account_status in ('A', 'S') and rownum<=100;
When I do that I am getting less than 50 distinct account numbers. Thanks in advance for your help.

Hi,
If you want to use ROWNUM, do it this way:
WITH  got_accounts AS
    SELECT DISTINCT  account
    FROM             s.sub_account      -- I'm guessing s is the schema name
    WHERE            account_status IN ('A', 'S')
SELECT  account
FROM    got_accounts
WHERE   ROWNUM  <= 100;
ROWNUM is computed as the rows are fetched.  DISTINCT is applied after the rows have all been fetched, and the WHERE clause has been evaluated.  The query above computes ROWNUM on values as they are being fetched from the sub-query, that is, after the filtering for account_status has taken place, and the distinct values have been identified.
Depending on your exact requirements, you might want to use the analytic ROW_NUMBER or DENSE_RANK function instead of ROWNUM.
I hope this answers your question.
If not, post  a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002

Similar Messages

  • How to select Specific Bank Account and Cheque Lot no. while making payment

    I have define 3 bank account for a given House bank.
    For e.g For ICICI bank we have account in 3 different branch and depends on requirement we make payment for different bank.
    e.g - GL code 20000100, 20000101, 20000102 for one location 0 being main and 1& 2 sub a/c  - House Bank Code - ICIC & Account 3888
            GL code 20000200, 20000201, 20000202 for one location 0 being main and 1& 2 sub a/c - House Bank Code - ICIC & Account 4888
            GL code 20000300, 20000301, 20000302 for one location 0 being main and 1& 2 sub a/c - House Bank Code - ICIC & Account 5888
    We have defined cheque lot no,. for all the 3
    Lot No. 1  - For 3888               500001 - 500100
    Lot No. 2 - for  48888             600001 - 600100
    Lot No. 3 - for  58888              700001 - 700100
    While selecting for payment it takes Lot 1 for first account it is working fine, if we select lot 2 or 3 we get following error message
    Lot 0002 Not found
    Request you to guide
    Regards
    Mahendra

    Helllo Srinivas,
    I have forgotten to mention that we are using f-58 transaction to make payment and we are able to select lot no. but it is not recognising and gives error
    Regards
    Mahendra

  • HT202213 I have 3 users on one computer with 3 unique user accounts.  Each have unique ITunes accounts.  How do we share our music libraries using home sharing?

    I have 3 users on one computer with 3 unique user accounts.  Each of us have separate and unique ITunes accounts.  How do we share our music libraries using Home Sharing?  Everything that I can find talks about sharing between networked computers, but this is all on the same computer.  I just want to share between ITunes accounts.  Thanks!

    Hi b noir, I also have two users on one pc with two different iTunes libraries.  But I also want to put them onto an external hard drive so that I can free up some memory on the pc.  So I figure I need to consolidate the two users iTunes libraries first before moving to hard drive?  But not quite sure how to do that on the iTunes 11?  Thanking you in advance!!

  • How can I uniquely identify computers on the same network/account specifically for airdrop use?  When I change name on one computer under contacts if changes on all computers.

    How can I uniquely identify computers on the same network/account specifically for airdrop use?  When I change name on one computer under contacts it changes on all computers.  I would like to change icon and name for each computer.

    you would need to setup a VPN and tunnel into your office.
    FYI..the default ports are 3283 and 5900.

  • How to select email account for sending notifications

    I have three calendars (for example, C1, C2, C3). My Mail application has 3 email accounts (A1, A2, A3).
    How can I make the calendar send notifications using a selected email account?
    For example, I want all calendar email notifications to be sent using account A2.
    I'll appreciate your help.

    sd0084,
    If I change, all my emails would go out the selected account.
    Correct.
    I routinely use that method, which means that I must select a different account in the "New Message" window "From:" field when I choose to send mail from a different account.
    ;~)

  • Buddies with multiple jabber accounts - How to select?

    I use iChat Jabber support to connect to MSN and ICQ networks. I associate the msn/icq users with a profile in the address book so I see the names in the buddies list (instead of [email protected] server.com
    The problem is when a single user is in more than one network (with a msn and an icq account for instande). In this case iChat only shows one entry in the buddies list, no matter if the user is online at msn, icq or both. This is fine, but when I wanto to send a message and I double clik on the buddies name it always selects the Yahoo account for sending the message.
    Is there a way to select the other account (MSN) without duplicating the address entries in Address book?
    Thank you

    Hi bmoraes,
    Welcome to the Apple Discussions
    Is there a way to select the other account (MSN) without duplicating the address entries in Address book?
    The answer is NO.
    7:43 PM Thursday; June 22, 2006

  • How to select multiple values from the parameters in BI Publisher report

    How to select multiple values from the parameter drop down in BI Publisher, and how to handle this mulitple values from the report sql...

    Hi kishore,
    I have used all the steps as you mentioned in your previous reply....including checking Mulitple Selection Check Box..
    Iam able to get the results when I am selecting one value..
    and also I am able to handle multiple values the in the query by using IN :Parameter, but seems when we select more than one value from the parameter drop down i think the Bi Publisher is sending the values in concatenated form something ilke
    ex: "'ACCOUNT','HR','SALES'" ,and when trying to display the parameters values in the output, its throwing the error as 'missing right paranthesis' ....on the whole do you have any solution which would handle
    1.Single selection.
    2.Multiple selection.
    3.'ALL' Values.
    4.Separating the concatenated string into individual strings and dispaly them on the output of the report..etc..in case of Mulitple selection.
    Ex:
    Concatenated String from BI Publisher:"'ACCOUNT','HR','SALES'"
    Expected Output on the report:ACCOUNT,HR,SALES
    reply to this would be much appreciated....
    thanks,
    manoj

  • How to change the reconciliation account in customer master record?

    hi friends,
    i created customer master with wrong reconsiliation account in XD01. i failed when i am trying to change that reconsiliation account in XD02. it was suppressed. how to change the reconcilition account in customer master data?

    Hi,
    Go to this path: Spro>Financial Accounting>Account Receivable & Account Payable>Customer Accounts>Master Data>Preparations for Creating Customer Master Data>Define Account Groups with Screen Layout (Customers)
    Double Click on Your Group, Then Click on Company code Data under Field Status, Then Double click on Account Management, That screen you will find the Reconcilation Account, Select Requred Entry.
    now it will coming Customer master.
    It's useful assigne points as a way to say Thanks
    Regards
    gvr

  • How do I have multiple accounts on the same computer

    how do I have multiple accounts on the same computer? The idea of ", hold down the option (on a Mac)/ shift (on a PC) key each time you start iTunes" does not seem to work for me. Thanks.

    Create multiple Windows User Profile with each managing his own iTunes account and library.
    To create a user account on Windows 7:
    To open User Accounts, click the Start button , click Control Panel, under 'User Accounts and Family Safety', select Add or Remove User Accounts.
    Click Create a new account.
    Type the name you want to give the user account, click an account type(make sure to give Administrator), and then click Create Account.

  • How can I retrieve my account I forgot my security question?

    Please I want to make a purchase online through my iPad, but I couldn't due to some problem that is related to my ID. How can I retrieve my account? I forgot my security questions

    From an older post by King_Penguin:
    If you can't remember the answers to the security questions, then go to Express Lane  and select 'iTunes' from the list of 'products' in the middle of the screen.
    Then select 'iTunes Store', and on the next screen select 'Account Management'
    Next choose 'iTunes Store Account Security' and fill in that you'd like your security questions/answers reset.
    You should get an email reply within about 24 hours (and check your Spam folder as well as your Inbox).

  • How to find out the account group information in customer master record?

    how to find out the account group information in customer master record?
    in which tab? thanks in advance

    Hi
    Go to XD02 and select the Extras from the main menu , you will find Account group info -> click on the No.ranges.
    reward if it helps
    SR

  • How can I remove an account and apps from another user from my Ipod. My nephew used to live with me and everytime I sync my Ipod his stuff is added to mine. I have no way to contact him for his password.

    I need to know how to remove an iTunes account associated with my computer. My nephew used to live with me but has moved out. Everytime I sync my iPod touch his stuff is added to my device. I have no way to contact him to get his password. How can I make this go away. He listened to music that is very offensive to me and I dont want it in my library or playlists. Any help would be greatly appreciated.
    Thank you in advance,
    Shelly

    You can use computer iTunes to help.
    Connect your iPod Touch to Computer's iTunes
    In iTunes, select your iPod Touch under DEVICES (left pane).
    On right pane select Music at the top.
    Now you can de-select the music/playlist or anything you don't want and click Sync button bottom right.
    You can do the above for Apps, Books, etc.
    You can of course, de-authorize the computer in iTunes menu Store.
    Note: That will make everything using his AppleID inaccessible.

  • GRR1 report painter how to explode at GL account level ?

    Dear Experts,
    I am preparing a balance sheet using report painter GRR1. in the characteristic i assigned the group account number and set as explode. however when i see the report it is exploded at group account number only asterisk level i set is 01. do you guys have any idea how to explode at GL account level? do i need to define asterisk level upto 03 ? if yes how to create asterisk level ?

    Hi,
    For each head like Trade Receivables, Trade Parables, etc, Did you explicitly maintain the GL acct. range by selecting 'Account Number' as Characteristics in that line?
    Thanks,
    Nirav

  • How to  select multiple chek in checkbox in alv

    how to  select multiple chek in checkbox in alv

    Hi,
    Following report is the checkbox alv sample report.
    REPORT  YMS_CHECKBOXALV.
    TYPE-POOLS: slis.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    DATA: s_layout TYPE slis_layout_alv.
    DATA: BEGIN OF itab OCCURS 0,
    icon TYPE icon-id,
    vbeln TYPE vbeln,
    kunnr TYPE kunnr,
    erdat TYPE erdat,
    box TYPE c,
    END OF itab.
    DATA: v_repid TYPE syrepid.
    START-OF-SELECTION.
    Get the data.
    SELECT vbeln kunnr erdat UP TO 100 ROWS
    FROM vbak
    INTO CORRESPONDING FIELDS OF TABLE itab.
    IF sy-subrc <> 0.
    MESSAGE s208(00) WITH 'No data found'.
    LEAVE LIST-PROCESSING.
    ENDIF.
    Modify the record with red light.
    itab-icon = '@0A@'.
    MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.
    v_repid = sy-repid.
    Get the field catalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'ICON'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-seltext_l = 'Status'.
    s_fieldcatalog-icon = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'VBELN'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'KUNNR'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'KUNNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'ERDAT'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'ERDAT'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    Set the layout.
    s_layout-box_fieldname = 'BOX'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = s_layout
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = t_fieldcatalog[]
    TABLES
    t_outtab = itab.
    FORM SET_PF_STATUS *
    --> EXTAB *
    FORM set_pf_status USING extab TYPE slis_t_extab.
    SET PF-STATUS 'TEST2'.
    ENDFORM.
    FORM user_command *
    --> UCOMM *
    --> SELFIELD *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
    Check the ucomm.
    IF ucomm = 'DETAIL'.
    LOOP AT itab WHERE box = 'X'.
    itab-icon = '@08@'.
    MODIFY itab TRANSPORTING icon.
    ENDLOOP.
    ENDIF.
    selfield-refresh = 'X'.
    ENDFORM.
    Thanks,
    Sankar M

  • HT201304 How can I change the account card on file to a different card?

    How can I change the account card on file to a different card?

    HT1918 iTunes Store: Changing account information
    Learn how to change your name, billing address, email address, and credit card information for your iTunes Store account.
    Note: If your previous payment method was not accepted, you can edit your payment type or credit card information by following the steps in this article.
    You can change all of your account information from the Apple Account Information page. To get to the Apple Account Information page, follow these instructions:
    Changing your account information using a computer:
    Open iTunes.
    Choose Store > Sign In.
    Enter your Apple ID and password, then click the Sign In button.
    Choose Store > View My Account.
    Enter your account password, and click the View Account button.
      To update your email address, follow these instructions: 
    From the Apple Account Information page, click the Edit button to the right of your Apple ID.
    Enter your new email address into the Email Address field.
    Click the Done button.
      To update your name, billing address, or payment information, follow these instructions: 
    From the Apple Account Information page, click the Edit Payment Information button.
    Edit the information that you would like to change.  Note: The payment methods that the iTunes Store accepts can be found in the payment type section. If you do not want a payment method on your account, select None in the payment type section.
      Click the Done button once you've updated all of your information.
    Changing your account information using an iOS device:
    Tap Settings on the Home screen.
    Tap iTunes & App Stores.
    Tap on your Apple ID. (If you are not signed in, enter your Apple ID and password, and tap Sign In.)
    Tap View Apple ID.
    Enter your Apple ID password.
      To update your email address, follow these instructions: 
    In the Edit section, tap the Apple ID field.
    Tap the Apple ID field.
    Enter the email address that you would like to be your Apple ID.
    Tap the Done button.
      To update your name, billing address, or payment information, follow these instructions: 
    In the Edit section, tap Payment Information.
    Update the information that you want to change.
    Tap the Done button when finished.
    Additional Information  Notes 
    If you use an AOL screen name to sign in to the iTunes Store, editing your information on the Apple Account Information page will not carry over to your AOL account. If you need to update your AOL account information, contact AOL.
    If your account information does not match your credit card, you may get a message stating "The credit card was declined."
    When you update your credit card number or billing address through the iTunes Store, any equivalent information you might use with iCloud, Apple Store online, iPhoto, or Aperture is also updated.
    The iTunes Store will place a minimal authorization hold on your credit card each time that you update your account information (equal to around 1 USD). The authorization hold is not a charge. The authorization hold is placed on your credit card to make sure that the information provided matches the information on file with your financial institution. The authorization hold will not be displayed in your iTunes Store purchase history.
      Important: Information about products not manufactured by Apple is provided for information purposes only and does not constitute Apple’s recommendation or endorsement. Please contact the vendor for additional information.
    Last Modified: Sep 24, 2012

Maybe you are looking for