Count  the total of SELECT command to particular table

Hi,
Does anyone know how to count SELECT command for particular table in certain period, like one day / week / month ?
Regards,
Alianto

Assuming you have a date column to differentiate, then something like:
SELECT COUNT(*)
FROM table
WHERE date_column BETWEEN TO_DATE('20030119 00:00:00','yyyymmddhh24:mi:ss') AND TO_DATE('2003011923:59:59','yyyymmddhh24:mi:ss')will count records for Jan 19. Just substitute the appropriate range for what you want to count for the others.
TTFN
John

Similar Messages

  • How to find the total number of pair under particular parent according to pattern 1:2or2:1,1:1 day to day maximum up to 5 pair caping daily

    Dear friends,
    I provide full details here ,my database table structure ,data and stored procedure and my problem ,
    please review it and provide the solution or any idea to solve my problem.
    I am working on a project in which members are added in a tree pattern, and get the payment accordingly.
    below is my table structure ,data and stored procedure
    CREATE TABLE Associate_Income
    ID varchar(30) NOT NULL,
    ParentID varchar(30) NULL,
    IsLeft tinyint NULL,
    IsRight tinyint NULL,
    joingdate datetime NOT NULL
    go
    INSERT Associate_Income
    (ID, ParentID, IsLeft, IsRight, joingdate)
    SELECT 'Ramesh123', NULL, NULL, NULL '2014-01-03 16:31:15.000' UNION ALL
    SELECT 'Sonu', 'Ramesh123', 1, NULL, '2014-01-03 16:45:21.000' UNION ALL
    SELECT 'Pawan kumar', 'Ramesh123', NULL, 1, '2014-01-04 16:50:23.000' UNION ALL
    SELECT 'Ravi123', 'Sonu', 1, NULL, '2014-01-04 17:03:22.000' UNION ALL
    SELECT 'Vineet123', 'Sonu', NULL, 1, '2014-01-04 17:26:01.000' UNION ALL
    SELECT 'dev123', 'Ravi123', 1, NULL, '2014-01-05 19:35:16.000' UNION ALL
    SELECT 'Mukesh123', 'Ravi123', NULL, 1, '2014-01-05 19:40:41.000' UNION ALL
    SELECT 'poonam123', 'Vineet123', 1, NULL, '2014-01-05 19:49:49.000' UNION ALL
    SELECT 'monu', 'Pawan kumar', 1, NULL, '2014-01-05 17:32:58.000' UNION ALL
    SELECT 'Arti123', 'Pawan kumar', NULL, 1, '2014-01-05 19:54:35.000' UNION ALL
    My  database table Associate_Income  structure and data is as follow:
    ID ParentID IsLeft IsRight joingdate
    Ramesh123 NULL NULL NULL 2014-01-03 16:31:15.000
    Sonu Ramesh123 1 NULL 2014-01-03 16:45:21.000
    Pawan kumar Ramesh123 NULL 1 2014-01-04 16:50:23.000
    Ravi123 Sonu 1 NULL 2014-01-04 17:03:22.000
    Vineet123 Sonu NULL 1 2014-01-04 17:26:01.000
    dev123 Ravi123 1 NULL 2014-01-05 19:35:16.000
    Mukesh123 Ravi123 NULL 1 2014-01-05 19:40:41.000
    poonam123 Vineet123 1 NULL 2014-01-05 19:49:49.000
    monu Pawan kumar 1 NULL 2014-01-05 17:32:58.000
    Arti123 Pawan kumar NULL 1 2014-01-05 19:54:35.000
    by using below stored procedure i can count the total number of pairs under particular node in 2:1,1:1 ratio means first pair is completed when two node added to the left side of given parent node and one node added
    right side of given parent node after that all pairs are completed when one node added left side and one node added right side of parent node (1:1 ratio)
    example if i execute my stored procedure as follows it would return following.
    EXEC count_pairs 'Ramesh123'
    3
    so there is 3 pairs as shown in my figure.
    when we execute my stored procedure for ParentID 'sonu' it would return following.
    EXEC count_pairs 'sonu'
    2
    so there is 2 pairs as shown in my figure.
    My problem is to find the query which can return the total number of pair under particular node any given parent  node. day to
    day maximum 5 pairs in a day please any one can suggest us
    CREATE proc [dbo].[count_pairs]
    @ParentID nvarchar(50)
    as
    begin
    Declare @ParentSUM SMALLINT = 0
    Declare @SubLeftID nvarchar(50)
    Declare @SubRightID nvarchar(50)
    SELECT @SubLeftID = CASE WHEN [IsLeft] = 1 THEN [ID] ELSE @SubLeftID END
    ,@SubRightID = CASE WHEN [IsRight] = 1 THEN [ID] ELSE @SubRightID END
    FROM Associate_Income
    WHERE ParentID = @ParentID
    IF @SubLeftID IS NOT NULL AND @SubRightID IS NOT NULL AND EXISTS(SELECT 1 FROM Associate_Income WHERE [IsLeft] = 1 AND ParentID = @SubLeftID)
    BEGIN
    SET @ParentSUM = 1
    ;WITH Associate_Income_CTE AS
    SELECT [ID], [ParentID], [IsLeft], [IsRight], 0 AS [Level]
    FROM Associate_Income
    WHERE [ParentID] = @ParentID
    UNION ALL
    SELECT RecursiveMember.[ID], RecursiveMember.[ParentID], RecursiveMember.[IsLeft], RecursiveMember.[IsRight], Level + 1
    FROM Associate_Income RecursiveMember
    INNER JOIN Associate_Income_CTE AnchorMember
    ON RecursiveMember.[ParentID] = AnchorMember.[ID]
    SELECT @ParentSUM = @ParentSUM + COUNT([ParentID])
    FROM
    SELECT [ParentID]
    ,'IsLeft' AS [Direction]
    ,1 AS [Value]
    FROM Associate_Income
    WHERE [IsLeft] = 1
    AND [ID] <> @ParentID --AND [ID] NOT IN (@SubLeftID, @ParentID)
    AND [ParentID] NOT IN (@ParentID, @SubLeftID)
    UNION ALL
    SELECT [ParentID]
    ,'IsRight' AS [Direction]
    ,1 AS [Value]
    FROM Associate_Income
    WHERE [IsRight] = 1
    AND [ParentID] <> @ParentID
    ) AS Associate_Income
    PIVOT
    MAX([Value]) FOR [Direction] IN ([IsLeft], [IsRight])
    ) PVT
    WHERE [IsLeft] IS NOT NULL AND [IsRight] IS NOT NULL
    END
    SELECT @ParentSUM
    Jitendra Kumar Sr. Software Developer at Ruvixo Technologies 7895253402

    I don't think this is homework, I am not sure how helpful it was by Kalman to merge the two threads. It appears that two different persons posted the questions. It could be though, that it is the same problem and Jitendra has taken over Chandra's
    task.
    However, I was not able to understand the problem nor the figure. And nor the definition of pairs in this context. My assumption is that what Jitendra posted is an abstraction of the actual problem in order to not reveal intellecutal property. Possibly this
    makes the problem more difficult to understand for us outsiders.
    I've come so far that I worked out a table definition and INSERT statements with sample data, as well as a call to the procedure which returns 3 and this appears to map to the figure, but I don't know what it means. Since I don't know what this
    is about, I have not made any attepmts to understand the code, but I would appreciate clarification about the underlying business rules as well as the expected results for various test cases.
    CREATE TABLE Associate_Income(ID varchar(30) NOT NULL,
    ParentID varchar(30) NULL,
    IsLeft tinyint NULL,
    IsRight tinyint NULL,
    joingdate datetime NOT NULL)
    go
    INSERT Associate_Income (ID, ParentID, IsLeft, IsRight, joingdate)
    SELECT 'Ramesh123', NULL, NULL, NULL, '2014-01-03 16:31:15.000' UNION ALL
    SELECT 'Sonu', 'Ramesh123', 1, NULL, '2014-01-03 16:45:21.000' UNION ALL
    SELECT 'Pawan kumar', 'Ramesh123', NULL, 1, '2014-01-04 16:50:23.000' UNION ALL
    SELECT 'Ravi123', 'Sonu', 1, NULL, '2014-01-04 17:03:22.000' UNION ALL
    SELECT 'Vineet123', 'Sonu', NULL, 1, '2014-01-04 17:26:01.000' UNION ALL
    SELECT 'dev123', 'Ravi123', 1, NULL, '2014-01-05 19:35:16.000' UNION ALL
    SELECT 'Mukesh123', 'Ravi123', NULL, 1, '2014-01-05 19:40:41.000' UNION ALL
    SELECT 'poonam123', 'Vineet123', 1, NULL, '2014-01-05 19:49:49.000' UNION ALL
    SELECT 'monu', 'Pawan kumar', 1, NULL, '2014-01-05 17:32:58.000' UNION ALL
    SELECT 'Arti123', 'Pawan kumar', NULL, 1, '2014-01-05 19:54:35.000'
    go
    CREATE proc [dbo].[count_pairs]
    @ParentID nvarchar(50)
    as
    begin
    Declare @ParentSUM SMALLINT = 0
    Declare @SubLeftID nvarchar(50)
    Declare @SubRightID nvarchar(50)
    SELECT @SubLeftID = CASE WHEN [IsLeft] = 1 THEN [ID] ELSE @SubLeftID END
    ,@SubRightID = CASE WHEN [IsRight] = 1 THEN [ID] ELSE @SubRightID END
    FROM Associate_Income
    WHERE ParentID = @ParentID
    IF @SubLeftID IS NOT NULL AND @SubRightID IS NOT NULL AND EXISTS(SELECT 1 FROM Associate_Income WHERE [IsLeft] = 1 AND ParentID = @SubLeftID)
    BEGIN
    SET @ParentSUM = 1
    ;WITH Associate_Income_CTE AS
    SELECT [ID], [ParentID], [IsLeft], [IsRight], 0 AS [Level]
    FROM Associate_Income
    WHERE [ParentID] = @ParentID
    UNION ALL
    SELECT RecursiveMember.[ID], RecursiveMember.[ParentID], RecursiveMember.[IsLeft], RecursiveMember.[IsRight], Level + 1
    FROM Associate_Income RecursiveMember
    INNER JOIN Associate_Income_CTE AnchorMember
    ON RecursiveMember.[ParentID] = AnchorMember.[ID]
    SELECT @ParentSUM = @ParentSUM + COUNT([ParentID])
    FROM
    SELECT [ParentID]
    ,'IsLeft' AS [Direction]
    ,1 AS [Value]
    FROM Associate_Income
    WHERE [IsLeft] = 1
    AND [ID] <> @ParentID --AND [ID] NOT IN (@SubLeftID, @ParentID)
    AND [ParentID] NOT IN (@ParentID, @SubLeftID)
    UNION ALL
    SELECT [ParentID]
    ,'IsRight' AS [Direction]
    ,1 AS [Value]
    FROM Associate_Income
    WHERE [IsRight] = 1
    AND [ParentID] <> @ParentID
    ) AS Associate_Income
    PIVOT
    MAX([Value]) FOR [Direction] IN ([IsLeft], [IsRight])
    ) PVT
    WHERE [IsLeft] IS NOT NULL AND [IsRight] IS NOT NULL
    END
    SELECT @ParentSUM
    END
    go
    EXEC count_pairs 'Ramesh123'
    go
    DROP PROCEDURE count_pairs
    DROP TABLE Associate_Income
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Ho to count the total number of rows Sql Reporting Services Report Builder's Dataset after filteration based on parameter

    Hi to all,
                 I have parameter and data-set i.e consists of SharePoint List items,Data-set get's  filters and I need to count the total rows of the data-set i.e I get after filtration.
    Thanks, Quality Communication Provides Quality Work. Mohammad Siddiqali.

    Hi siddiqali,
    Thanks for the question and Destin Joy’s reply. Please try to add the filter in the dataset level rather than the data region
    level. Detail steps as below.
    1.      
    Double-click the dataset name in the Report Data window, click Filters in the left panel.
    2.      
    Click Add button, choose Admission Date in the Expression drop-down list. Type in the Value textbox with the parameter name: @selectDate.
    3.      
    Right-click the cell that your identified by the red circle, select Expression, type in it with:
    =CountRows("DataSetName")
    Thanks,
    Sharp Wang
    Please remember to mark the replies as answers if they help you and unmark them if they provide no help.

  • Count the total val of the column in matrix

    hi
    how to count the total value of the column in matrix
    eg:
    id     name     points
    10    sachin    100
    12     rama        80
    count the total points in the matrix
    180

    Hi Hareesh,
    Try This....
      Dim finaltot As Integer = 0
                    Dim i As Integer
                    For i = 1 To omatrix.RowCount
                        oedittot = omatrix.Columns.Item("points").Cells.Item(i).Specific
                        finaltot = finaltot + oedittot.value
                    Next
    Thanks
    Shafi

  • How can you find the Last Modified Date of a particular table

    Hi,
    I want to show to the LAST MODIFIED date of a particular table to the user before refreshing the table with new data. Experts please suggest me the way using JDBC-SQL connection.

    There is no generic SQL way for this. It depends completely on the features your DBMS offers. With Oracle you'd need to create column which gets updated in a trigger. I believe MS SQL Server offers a special data type for this, which is updated automatically. I don't know about others.

  • Count the total amount of records returned

    Is there a way in DW to count and display the total amount of records in my DB table?
    Eg: I might have 10,000 records in my database, but only 55 match the SELECT statement, so I want to show a visual counter saying '55 articles in this section' on my page.

    Choose one of these  function appropriate to the api you are using:
    http://php.net/manual/en/function.mysql-num-rows.php

  • Servlet to count the number of occurances of a particular node

    Hi
    I am looking for a servlet which will count the number of a particular node which I have supplied of an XML file.
    Can somebody please help me with this?
    Thankyou

    If you are using Xerces, after you have parsed your XML files using a DOMParser, get the document object from the parser like
    Document document = parser.getDocument();
    And then use the command getElementsByTagName("*"); // for all elements
    it will return the node list object (NodeList) which you can get the count (nodeList.getLength())

  • How count the total number of instances ?

    I have 2 scenarios :-
    1. How to get the total number of instances of  the node  in a BO?
    eg :
    businessobject BO1   {
    element BO_ID;
                       node NODE1 [0..n]
                         element Node_ID;
                         element Status ;
                         element value:
    I want to get total number of the NODES instances in the particular instance of the BO1.   !!!?????
    2. I want to  make some calculations based on the attributes of the NODE1 , in the   BeforeSave .absl  of the Business Object BO1.
    eg:
    something like this :-
    In BeforeSave of BO1.absl -
    for ( all the instances in NODE1 )
    {   if (NODE1.status == true)
                 sum = sum + NODE1.value
    Please help !!!!

    Your approach is correct.
    You can use a standard Query or create your own Query to run through Datainstances.
    Documentation with examples for Queries in ABSL see here: https://my020062.sapbydesign.com/sap/ap/ui/repository/SAP_BYD_WEKTRA/CP/sapLSUIContentPlayerTestPage.html?manifest=067D03A7602B1D490899DF46B5082089&COMPONENT=A1S_PDI&RELEASE=260&LANGUAGE=en&REGION=&INDUSTRY=&TASK=CR_VIEW&sap-language=EN
    Looking / Clincking  for "SAP Business ByDesign Scripting Language" and "Syntax for Implementation of Actions and Events" and "Query"

  • How to count the total lines of the file (including the file header)

    Hi all,
    I am working with Idoc to file scenario(FCC).
    I need to map one of the field with a recound count ie.., count of the total lines of the file (including the file header).
    Eg:Record Count-- mapping area:Total number of records in the file including file header     The total line of the file (including the file header).
    Can i get a help on this.
    Thanks and Regards,
    Manoj

    Hi !
    If there is a tag of your IDOC that occurs the same quantity of times as file lines you have to create in your target file, you could make a Java user defined function in graphical mapping that "caches the entire queue" (use the corresponding option button), that receives as input that field of the IDOC, and returns the "lenght" (.length property value) of that input parameter (it is an array) as output..that should be the file line quantity..you may also add 1 to that count, for the header.
    Hope it helps.
    Regards,
    Matias.

  • How to calculate the total sum value of a particular field that repeats

    Hi All,
    I have the following Req...File----Idoc Scenario
    In the Inbound xml file i will get the Sales Order details with suppose 10 line items( 10 Orders)
    Each line item represents one one SO. So totally i wil have 10 Sales Orders in this file.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Sales_Order xmlns:ns0="http://sap/Sales_Order">
       <Header>
          <COMP_CODE></COMP_CODE>
          <DOC_TYPE></DOC_TYPE>
           <SUPPL_VEND></SUPPL_VEND>
       </Header>
       <Item>
          <ITEM></ITEM>
          <MATERIAL></MATERIAL>
          <PLANT></PLANT>
          <QUANTITY></QUANTITY>
          <Amount></Amount> 
    </Item>
    In the above structure Item Segment will repeats as many no. of Sales Orders comes in a file.
    In a file if there are 10 Orders means the Item segment wil repeats 10 times.
    I have the Amount field in the Item Segment, each and every time that needs to be added to next Amount value that presents in the next Line Item.
    Finally i will have the Another separate field caled Grand Total, and i have to get the total summation of the 10 values of the Amount field at last.
    Can we achieve this using UDF or is there any way to do this
    REgards

    Hi,
    Do like this, actually in your case sum is taking place before the condition check for discount type
    do a little change in mapping
    DiscntType--removeContext--
                                              EqulsS-------IfWithoutElse----Amount---removecontext--then---SUM-
    Connstatnt(Value)
    --->GrandAmount
    Krishna, Check the same question asked by Rajesh in thread Calculate totals of segments that occur multiple times
    Thanks!

  • How do I count the number of cells with a particular text in it?

    I have a column with peoples name in each cell. I want to count the numbe rof times a persons name appears in the column. How do I do this? any help would be great ! thanks in advance.

    Hi Evilhomer,
    The function COUNTIF will do this. Here are two Tables on one sheet. Table 1 contains names in Column B.
    Table 2 contains the names once only (in any order) in Column A, with a COUNTIF formula in Column B to count how many times a name occurs in Table 1.
    The formula in Sheet 2, Cell B2 is:
    =COUNTIF(Table 1 :: B2:B5,A2)
    Enter the formula in B2 then copy down.
    It is easier to create the two tables on one sheet. If you then want to move a table to another sheet, Numbers will convert the formulas to keep the references valid.
    There are other ways to do what you want. Please reply if this is not what you want.
    Regards,
    Ian.

  • How to count the total lines of code in Java project in NWDS

    Hi,
    I have created a simple web application in java using NWDS. For audit purposes, I need to know the total lines of java code in this project.
    We use Netweaver Development Studio (NWDS) to build & deploy the Java applications
    Is there any tool available in NWDS that cant do this job quickly ?
    Thanks in advance.
    Vikram

    Hi All,
    I have found out the solution to this problem.
    There is a SAP tool - Jlin thats available in NWDS.
    Further reference, see this
    http://help.sap.com/saphelp_nw04/helpdata/EN/f7/3d9d3c838436428a154abc3816fd9c/frameset.htm
    Cheers
    Vikram

  • Count the total number of licenses of any product of my environmen

    Good afternoon, 
    First of all thanks for the help. 
    I have sccm 2007 R2, I have enabled and running the asset intelligence and Reporting Services. 
    I need to find out what the total licenses used in any program for example, any version of Adobe or Oracle. It is possible or only asset intelligence can perform from the Reporting Services?. 
    The idea is to have an overview of all of Adobe licenses used on all servers of my corporation. It would be interesting to have a list of all Adobe products installed on all servers, it is possible? 
    Thanks again it is very urgent to me:> 
    Sopitas.

    Do you want to know installed or actually used? This is most definitely possible with AI however what are asking for is not so easy out of the box. I personally use a
    third party add-in
    to accomplish this task by cleaning up and consolidating the data in the database.
    John Marcum | http://myitforum.com/myitforumwp/author/johnmarcum/

  • OCCAS, How to count the total invite request hit the server.

    Hi All ,
    I wanted to count the incoming (invite) request hit the sever.How can i do the same.
    Do we have any facility available in OCCAS by which we can count the request.
    I believe there should be some monitoring system available but i am not sure.
    Plz reply, its URGENT.

    You can define a logging servlet, see for an example here: http://download.oracle.com/docs/cd/E13209_01/wlcp/wlss40/operations/pdulogging.html

  • How do i find the total number of fields within all tables in one of my databases

    I'm in the process of creating some "gee whiz" metrics for one of my applications and want to find the total number of columns contained in its database.  Is there a stored procedure to get this information that would save me the effort
    of opening each of my 66 tables and counting the columns?  I also have the same question for my 138 views.  Thank you for any ideas you care to offer...............Phil Hoop
    Phil Hoop

    Hi Phil,
    Assumes SQL 2005 or higher
    Let 's try simple one ....
    SELECT COUNT(col.column_name), col.table_name
    FROM information_schema.columns col
    JOIN information_schema.tables tbl
    ON tbl.table_name = col.table_name
    AND tbl.table_schema = col.table_schema
    AND tbl.table_catalog = col.table_catalog
    AND tbl.table_type = 'VIEW'
    GROUP BY col.table_name
    Let me know if this will help you.
    If you think my suggestion is useful, please rate it as helpful.
    If it has helped you to resolve the problem, please Mark it as Answer.
    Varinder Sandhu www.varindersandhu.in

Maybe you are looking for

  • How to use a table UI in widget

    Hi Experts,    I want to use one table UI in my widget application. My requirement is to add records to table on click of a button. Here i am not using any RFCs. When i checked table UI, it is showing option to bind RFC with table. But i dont want RF

  • HT5654 cannot download latest itunes update?

    cannot download latest itunes update

  • Slow framerates and weird shaders in game

    Inside the game "Sauerbraten" which is a 3D shooter, I get very low framerates and some surfaces with shaders have strange glitches on them. I have Mac OS X Leopard 10.5.2, and I have the game and OS up to date. To make sure this wasn't just with the

  • Has any one (or) can we  run 11i and R12 in single AIX 5.3 OS

    Hi, I have a requirement for running 11.5.10.2 and R12.1.3 in single AIX 5.3 OS. The only thing i doubt about is the pre-requisites like Java version, and other packages. Would be there be any conflict or version mismatch. Thanks

  • SAP Customer Exit - Customer Namespace (i.e. /ABC/)

    Hi ABAP Experts, The question I would like to ask is when taking advantage of a SAP customer exit, can you assign the work to a customer namespace (i.e. /ABC/) ? The problem seems to be that we want the majority of our custom development in our custo