Quer to find total no of rec

query to find total number of peoples in a office and also number of peoples who were in the year 1991, 1992, 1993, 1994
eg:
Table
Name_ DOJ_
aaa 21-05-92
bbb 03-10-93
ccc 30-12-93
ddd 28-05-91

SQL> create table t (name,doj)
  2  as
  3  select 'aaa', date '1992-05-21' from dual union all
  4  select 'bbb', date '1993-10-03' from dual union all
  5  select 'ccc', date '1993-12-30' from dual union all
  6  select 'ddd', date '1991-05-28' from dual
  7  /
Tabel is aangemaakt.
SQL> select count(*) "No_Of_Staff"
  2       , count(decode(extract (year from doj),1991,1)) "Joined_On_1991"
  3       , count(decode(extract (year from doj),1992,1)) "Joined_On_1992"
  4       , count(decode(extract (year from doj),1993,1)) "Joined_On_1993"
  5    from t
  6  /
No_Of_Staff Joined_On_1991 Joined_On_1992 Joined_On_1993
          4              1              1              2
1 rij is geselecteerd.Regards,
Rob.

Similar Messages

  • ABAP statement to find total no. of recs

    Hi,
    There is a table with two fields f1 and f2.
    f1 is the primary key of the table.
    For a particular value of f2 I want to know the total no of records in the above table.
    What is the most efficient way to do it.
    Please guide me,
    Thanks,
    CD

    select count * into l_recs from dbtable where f2 = value.
    regards,
    Advait

  • How to find total recs in a local table for a particular condition

    Hi,
    How to find total recs in a local table for a particular condition?
    Thanks,
    CD

    Well, you may want to try this as well, and compare to the LOOP way.  Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it.  Again I think there may be some overhead in doing the copy.  Next, delete out all records which are the reverse of your condition.  Then whatever is left is the rows that you want to count.  Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1 <> 'A'.
    lv_count = lines( itab_tmp ).
    Regards,
    Rich Heilman

  • SQL queries for finding values in 4 different tables

    I need to have certain queries to find specific data in this table, this is just an example table, but I will use the same ideas for my actual website and database.
    customers (customerID: integer, fName: string, lName: string)
    items (itemID: integer, description: string, price: float)
    orders (orderID: integer, itemID: integer, aID: integer, customerID: integer, date: date)
    addresses (aID: integer, housenum: integer, streetName: string, town:string, state: string, zip:integer)
    Values I need to find are
     List the town, first name, and last name of any customer who has shipped an item to the same town as another customer.
    Return the average amount of money each customer spent in March of 2013. (Note that the answer will be a single number
    List the first and last names of all customers who have had the same item shipped to at least two different addresses.
    List the top two states that have generated the most total revenue and the revenue they generated
    I did try a few different queries, for #3 I tried 
    SELECT customers.fName,
    customers.lName,
    COUNT(orders.itemID) AS `total items with diff address >= 2`
    FROM customers
    JOIN (SELECT customerID,itemID,
    COUNT(DISTINCT aID) AS diff_address
    FROM orders
    GROUP BY orders.itemID
              HAVING diff_address >= 2
             ) AS orders
          ON orders.customerID = customers.customerID 
    but I only got 1 result, and I do not think thats correct.
    Thanks for the help and I appreciate you taking the time to help me

    Why not post the sample data + desired result? Always state what version you are using.
    SELECT lname,A.aID,COUNT(*) cnt  FROM customers C JOIN orders O ON c.Customerid=O.Customerid 
    JOIN address A  ON A.aID=O.aID
    GROUP BY lname,aID
    Sorry  cannot test it right now...
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Hw to find total number of records

    Hi All,
    Can anyone help from these
    1. how to find total number of reports for a particular cube/ods... need step - step solution
    2. how to find total number of records for a particular Cube and ODS and Aggr's to till date.
    3.what is sandbox,mirror sys,instance of a sys..?
    4.what r TWS(Tivoli Workload Scheduler) jobs? how these r different to standard schedulers?
    Thanks in ADv
    Linda

    Hello Linda,
    As you have lots of answers on first 2 so i'll start from 3rd onward.
    3. Sandbox is mostly practice system where you can do all kind of R&D, mirror sys can be mirror image of any system depends on the organization and instance of system is again mirror image of one system.
    4. TWS is third party tool for scheduling which doesn't come along with SAP like standard scheduler as TWS has been prepared specially for this purpose so it has some more features than standard.
    Hope it helps.
    San.

  • Need to find total no fo  tables/index/m.views in my database

    Hello Everyone ;
    How can i find total no fo  tables/index/m.views in my database ?
    when i  google  i have seen  following  command ;
    SQL> Select count(1) from user_tables where table_name not like '%$%' /
      COUNT(1)
             but i dont understand  what  '%$%'  indicates ?
    Thanks all ;

    Hello Everyone ;
    How can i find total no fo  tables/index/m.views in my database ?
    when i  google  i have seen  following  command ;
    SQL> Select count(1) from user_tables where table_name not like '%$%' /
      COUNT(1)
             but i dont understand  what  '%$%'  indicates ?
    Thanks all ;
    consider to simply Read The Fine Manual YOURSELF!
    Oracle Database Search Results: like

  • Need to Find Total number of InfoPart form in our Web application

    Hello,
    We have to find total number of Infopath forms in our web application. IS there any Power sheell Scripts or anuthing which can output the Infopath Forms location and file count .
    Thanks
    Kundan

    How about something like:
    Get-SPWebApplication http://yourWebAppUrl |
    Get-SPSite -Limit All |
    Get-SPWeb -Limit All |
    Select -ExpandProperty Lists |
    Where { $_.GetType().Name -eq "SPDocumentLibrary" -AND -NOT $_.Hidden } |
    Select -ExpandProperty Items |
    Where { $_.Name -LIKE "*.xsn" }
    Select {$_.Web.Url}, Url
    The above will list all of the files. Do you need counts by library, by site or other?
    Mike Smith TechTrainingNotes.blogspot.com

  • How to find total no of record in cube

    Hi Experts,
    How to find total no of records in a cube.
    Thanks in Advance.

    Hi
    If you want total number of records in a CUBE then you have to check in both F Table and E table.
    Go to LISTSCHEMA tcode in your system, give your CUBE name and execute.
    You will fine two table E and F table
    goto SE16 -->give the table name and click on number of entries.You will get number of records.
    Check the below thread
    No of records in /size of Info cube
    Regards,
    Venkatesh

  • T-code or Table to find total errors in SAP APO like ST22 in ABAP

    hi all,
    Could please tell me the T-code or Table to find total errors in SAP APO like ST22 t-code in SAP ABAP.
    Thanks.
    Suryam S

    Hello Venu,
    Do you mean other functional errors?
    You can check SLG1, /SAPAPO/C3, STAD
    Best Regards,
    R.Brahmankar

  • To find total number of files inside folder

    Hai,
       In knowledge management is there any option to find total number of files inside folder...
        I also want to see the recently uploaded and modified documents in a seperate iview...
        Iam using NW2004s SP8..
        Very urgent..
        Waiting for a positive reply..
        Thanks&regards,
         Kiruthika.S

    Hi Kiruthika,
    1. You only need the configarchive if you don't want create all the KM configuration objects mentioned in the guide manually. So, just create the objects mentioned there and you don't need the configarchive
    Also, the scenario works also on 2004s.
    2. Please check this thread on how to show the total number of files inside a folder:
    https://forums.sdn.sap.com/thread.jspa?threadID=19610
    3. It would be nice if you would consider rewarding the time people like Saravanan spend to investigate and answer your question by assigning points via the colored stars.
    Best regards,
    Robert

  • To find Total Operating Expenses , what are all G/L Nodes to be added

    Dear Team,
             I have got requirement to find to Operating Profit Margin Ratio Using ABAP report, I have searched for formula in forums
    I got the formula.
    Operating Profit Margin Ratio = Operating Profits /  Income.
    ::Operating Profits = Gross Profits - Total Operating Expenses.
    but i have calculated Gross Profits Value & Income value.  I am getting problem to find Total Operating Expenses.
    In our Balance sheet they maintain "Direct Operating Expenses"
                                                             "General Administration Expenses"
                                                             "Financial Expenses"
                                                             "Depreciation".
    To find  total operating Expenses what are all i need to add to find it, please forward ur valuble feed back to me.
    It would help me.
    Thanks in advance..
    Urs,
    Vinay

    in the operating expenses you shall not consider the "Financial Expenses", because they are not caused by the operative part of the company.
    Paolo
    Edited by: Paolo G. on Oct 4, 2011 12:27 PM

  • How to find total in-use connection of a connection pool in Sun apps 8.1 ur

    Hi
    Thank you for reading my post.
    how i can find total open (in-use)connection of a connection pool ?
    sometimes my application take some longer time to do an specefic job , now i want to see how much connection of the pool is open and in use
    thanks

    Hi,
    Sun app.server provides monitoring facility using which we can find how many connections are in use, how many clients are in wait-queue etc.,
    You can refer the following URL of
    Sun Java System Application Server 8 - Administration guide.
    http://docs.sun.com/app/docs/doc/819-2554/6n4r8s7ti?a=view
    for enabling monitoring and getting monitoring values for a particular conn. pool
    Thanks,
    -Jagadish

  • How can i find total no of files in a directory ..using fileconnection

    how can i find total no of files in a directory.
    currently iam using
    Enumeration enum = fileconn.list(); and by iterating iam getting count.
    but the application is getting stuckup when the number of files in the directory is large.
    Is there any alternative. please help.
    thanks in advance.

    HI,
    this is a simple example with a cursor over user_tables view:
    set serveroutput on
    DECLARE
       CURSOR c_test IS
          SELECT table_name FROM user_tables;
       type t_reg is table of varchar2(30);
       l_reg t_reg;
    BEGIN
       OPEN c_test;
       fetch c_test bulk collect into l_reg;
       dbms_output.put_line(c_test%ROWCOUNT);
    END;
    /Output:
    SQL>
    SQL> set serveroutput on
    SQL> DECLARE
      2     CURSOR c_test IS
      3        SELECT table_name FROM user_tables;
      4     type t_reg is table of varchar2(30);
      5     l_reg t_reg;
      6  BEGIN
      7     OPEN c_test;
      8 
      9     fetch c_test bulk collect into l_reg;
    10 
    11     dbms_output.put_line(c_test%ROWCOUNT);
    12  END;
    13  /
    42
    PL/SQL procedure successfully completed
    SQL> Regards,
    Edited by: Walter Fernández on Nov 29, 2008 8:59 AM - Adding output...

  • Find Total Number of Rows in Database

    I am trying to find total number of rows in Database? Thanks in advance

    I'd come back to a question of "why". What possible reason could you have to want to know the number of rows in every table in the database?
    This seems like it is a request from someone non-technical where they're not sure exactly what they need to ask to get the information they want. I'm forseeing something along the lines of
    User: How many rows are in the database
    DBA: Ummm.... <<goes off and spends a lot of resources to count>>> ... 1 billion.
    User: Wow, that's a lot... How big are those rows...
    DBA: Hmmm... <<goes off and spends more time trying to find an average row size>>... 100 bytes
    User: <<Plugs numbers into Excel>>... OK, our database is 93 GB, so we need to order 100 GB of disk for our new environment.
    DBA: <<Months later, after 100 GB of disk has been budgeted, purchased, and delivered>> User, you didn't order enough disk for our disaster recovery environment.
    User: You said our database was only 93 GB!!
    DBA: 93 GB of data. Plus 100 GB of indexes, TEMP, UNDO, space for archived logs, ...
    When "odd" requests come down, it's generally the case that the person asking the question doesn't know what question they really want to ask because they don't have the domain knowledge to know how to ask the question. Walking over and asking them what they're hoping to accomplish/ what they're using the data for generally leads to a case where
    - The user gets exactly the information they need, not the information they think they want
    - The DBA does a lot less work, since the right question is almost always easier to answer
    - The user thinks of the DBA as a really helpful sort of guy and remembers how helpful you were in the past when you have to push back on other things later
    - No one ends up playing the blame game when the user gets just what they asked for and not what they want.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Function module to find total for delivey for delivery no.

    is there any function module to find total price for delivery no.

    If you want to add tax, ... conditions, you could try to read conditions (good luck).
    here it's a sample code for sales order (the table are different, but the function the same)
      DATA : is_vbak TYPE vbak ,
             is_vbap TYPE vbap .
    * Check if the sales order exist.
      SELECT SINGLE *
             INTO is_vbak
             FROM vbak
             WHERE vbeln EQ vbeln.
      IF sy-subrc NE space.
        RAISE sales_order_unknown.
      ENDIF.
    * Check if the sales order item exist.
      SELECT SINGLE *
             INTO is_vbap
             FROM vbap
             WHERE vbeln EQ vbeln
             AND   posnr EQ posnr.
      IF sy-subrc NE space.
        RAISE sales_order_item_unknown.
      ENDIF.
    * Set data.
      MOVE : is_vbak-mandt    TO isg_komk-mandt ,
             is_vbak-kalsm    TO isg_komk-kalsm ,
             is_vbak-fkara    TO isg_komk-fkart ,
             'V'              TO isg_komk-kappl ,
             is_vbak-waerk    TO isg_komk-waerk ,
             is_vbak-knumv    TO isg_komk-knumv ,
             is_vbak-vbtyp    TO isg_komk-vbtyp ,
             is_vbak-bukrs_vf TO isg_komk-bukrs ,
             is_vbak-vbeln    TO isg_komk-belnr ,
             is_vbap-posnr    TO isg_komp-kposn .
      MOVE-CORRESPONDING : is_vbak TO isg_komk ,
                           is_vbap TO isg_komp.
    * Get the KOMV table.
      CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
        EXPORTING
          comm_head_i = isg_komk
          comm_item_i = isg_komp
        TABLES
          tkomv       = itg_komv
          tkomvd      = itg_komvd.
    * Get the 'Marge'.
      CALL FUNCTION 'PRICING_BUILD_XKOMV'
        EXPORTING
          i_komk           = isg_komk
          i_komp           = isg_komp
          calculation_type = 'E'
        TABLES
          tkomv            = itg_komv
          e_xkomv          = itg_komv2
        EXCEPTIONS
          OTHERS           = 2.

Maybe you are looking for

  • How to open and  find right nr. range i

    In the middle in transaction "FP2P1" I am stucked I am asked to in order to open a number range.If I enter in message I get Check the number range for number range object FKK_P2P with transaction FPNP2P. Create the number range if it has not been cre

  • How to transport the BW query's variable to BO  webi report

    Hi all I'd like to know how to transport the BW query's variable to BO 's webi . today ,I created a sap customer varible in my bw system to get the max calmonth in the active table.The varible in the BW side run's well ,but I use this query to build

  • Wireless mouse and keyboard Windows 7

    I successfully installed Windows 7 (32 bit) on Apple boot camp (3.2) of my iMac 24. Everything is working perfectly, except my wireless Magic mouse and wireless keyboard. I found 2 Bluetooth adapters (Generic Bluetooth adapter and Microsoft Bluetooth

  • Calling an external report

    Hi gurus....... When calling an external report the parameters or select-options specified in the external report can be called or not?

  • Updated to iTunes  - won't connect to Store - tried everything!

    I've been through all KB items, tested everything suggested.  Here is text of diagnostics: Windows Firewall is on. iTunes is enabled in Windows Firewall. Connection attempt to Apple web site was successful. Connection attempt to browsing iTunes Store