How to get an count for a fields in fields

Hai All
I have created a table and the table contains three fields code,date,time and now i need to count that how many times the time come for a day
for example in this table is calculated for daily attendance
Code Date Time
001 01-02-10 0815
001 01-02-10 1115
001 01-02-10 1145
001 01-02-10 1645
002 01-02-10 0815
002 01-02-10 1200
002 01-02-10 1230
002 01-02-10 1715
003 01-02-10 0815
003 01-02-10 1655
here the example table is there so now i need to count that no times the time count is there for a day
for eg code 001 has 4, and 002 has 4 and 003 has 2
I have tried
select count(*) as ct,barcode from temp_attendance
group by barcode
order by barcode
Like this and works fine with only barcode field and while we give other fields in group by function and it calculate for each time.
while i using this in cursor i need to all the variable displayed and i need the count the count that code has
no of time.
Thanks & Regards
Srikkanth.M

Nikhil seems to be correct
WITH T AS
  ( SELECT '001' barcode, '01-02-10' bar_date, '0815' Systime FROM dual
    UNION
   SELECT '001' barcode, '01-02-10' bar_date, '1145' Systime FROM dual
    UNION
   SELECT '002' barcode, '01-02-10' bar_date, '0815' Systime FROM dual
SELECT barcode,systime,
  COUNT(*) over  (partition  by barcode,bar_date order  by  barcode)
  from  t;Thanks and regards
Sen
Edited by: Oracle beginner on Feb 18, 2010 2:37 PM

Similar Messages

  • How to get attendies count for a calendar list in sharepoint 2013?

    Hi everybody,
    I am using calendar list in SharePoint 2013 for my project.
    Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
    Because I want to display the fields like
    TOTAL SEATS =20
    Attendees= Need count
    Avail seats= total - Attendees count.
    In that way I want to show information about availability seats for training session.
    Regards,
    Dhayanand

    Hi Dhaya
    Please refer the links.Hope it helps :-)
    http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
    http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow

  • How to get change log for z-fields in VBAk(Sales order)

    Hi All,
    Please help me in this.
    My requirement is get the change log for z-fields in sales order.
    In the sales order header level we have one tab Additioanl data.
    In this we have z-fields, if we change any of the field value, it is accepting the same and updating in data base as well.
    But it is not appearing in change log<. I.e. Environment->changes.
    How to get the change log for the z-fields.
    In data element level enable the check box of change document.
    Please help me in this.
    Thanks in advance
    Jaya,G

    Hi Jaya,
    For this you need to do some coding. Here is a link which tells you, step by step procedure how to activate Change log for the Z tables.
    THe Object that you need to use for Sales Document   is VERKBELEG
    [https://wiki.sdn.sap.com/wiki/display/ABAP/Maintaining%20Change%20Log%20for%20Database%20Tables]
    Hope this helps..
    This is Primarily a Technical Consultant Job. Take his help before you make any changes.
    Thnks
    Srini

  • How to get row count(*) for each table that matches a pattern

    I have the following query that returns all tables that match a pattern (tablename_ and then 4 digits). I also want to return the row counts for these tables.
    Currently a single column is returned: tablename. I want to add the column RowCount.
    DECLARE @SQLCommand nvarchar(4000)
    DECLARE @TableName varchar(128)
    SET @TableName = 'ods_TTstat_master' --<<<<<< change this to a table name
    SET @SQLCommand = 'SELECT [name] as zhistTables FROM dbo.sysobjects WHERE name like ''%' + @TableName + '%'' and objectproperty(id,N''IsUserTable'')=1 ORDER BY name DESC'
    EXEC sp_executesql @SQLCommand

    The like operator requires a string operand.
    http://msdn.microsoft.com/en-us/library/ms179859.aspx
    Example:
    DECLARE @Like varchar(50) = '%frame%';
    SELECT * FROM Production.Product WHERE Name like @Like;
    -- (79 row(s) affected)
    For variable use, apply dynamic SQL:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Rows count all tables:
    http://www.sqlusa.com/bestpractices2005/alltablesrowcount/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to get the Count for no.of.errors

    HI
    BELOW IS MY CODE
    LOOP AT I_RETURN INTO WA_RETURN.
      IF WA_RETURN-TYPE ='E'.
        CONCATENATE SOURCE-AUFNR '|' SOURCE-VORNR '|'WA_RETURN-MESSAGE
                                                         INTO TEXT.
        WRITE:/ TEXT.
        COUNTER = COUNTER + 1.
      ENDIF.
    IM GETTING BELOW O/P
    000090001366 0020 Enter another operation number
    000090001366 0020 Error  during processing of BAPI methods
    000090001366 0050 Item categories in agreement and requisition incompatible
    000090001366 0050 Error  during processing of BAPI methods
    NO.Of records In Error          4
    My Requirement is if AUFNR and VORNR value is same then the count should be 1 , Like the o/p should be
    NO.Of records In Error          2
    because AUFNR and VORNR is same for 2 records , can any one tel me the logic to do this,
    AUFNR and VORNR value is there in Internal Table

    Hi All,
    Thanks for the replies.
    AUFNR and VORNR are in different tables so im putting them in one internal table
    loop at itab into wtab.
        wtab-aufnr = wa_methods-objectkey.
        wtab-vornr = wa_operation-activity.
    endloop.
    now
    IF WA_RETURN-TYPE ='E'.
    now if aufnr and VORNR is same then i should get error message as said above
    can any one tel me the logic

  • How to get the keys for a field in the dropdown list?

    The dropdown list of payment terms on an account is unfortunately very big, containing al lot of different values, in our system and therefore very confusing for the user working with Web UI version 5.2 to pick the right one. The keys (code like e.i Z077 or ZO23) are not stated in the list available for user. Is there any way in the system to flag if the different fields should show boths the keys(codes) and the description of the values in the field as Payment terms, etc.
    In the ERP SAP Gui it is possible to activate if you want the keys should be shown in all drop down list.
    If this is not possible for all the fields at one time, what can be a solution to have the keys in the drop down lists, any suggestion will be very valuable for us.
    Kindly regards
    Camilla

    HI Joost
    No it is not that simple, that is not a solution for us. The fields are maintained i our backend system and replicated to CRM, and these fields descriptions are also printed at Order confirmations and invoices, and we do not want the keys that do not give any meaning  to be visible to customers.
    BR
    Camilla

  • How to get the count for every 30 mins

    Hi,
    Following is the table format:
    Time ******************** logged in users
    9/5/2006 8:38:22 PM**** 2
    9/5/2006 8:38:44 PM**** 4
    9/5/2006 8:40:22 PM**** 1
    9/5/2006 8:41:22 PM**** 3
    9/5/2006 8:52:22 PM**** 6
    9/5/2006 9:02:22 PM**** 5
    9/5/2006 9:04:24 PM**** 3
    9/5/2006 9:08:26 PM**** 4
    9/5/2006 9:10:28 PM**** 6
    What I need is number of users logged in for every 30 min
    like 9/5/2006 9:00:00(8:30 to 9:00) is 16
    9/5/2006 9:30:00(9:00 to 9:30) is 18
    Can any one help me in this regard?
    -Raj

    The trick is to group your times to every 30 min.
    Unfortunatly there is no way to TRUNC(30 min).
    But you can build this function yourself using some mathematical logic and trunc to build the groups.
    Look at this code piece:
    select trunc(sysdate) + trunc((sysdate - trunc(sysdate))*24*2)/24/2
    from dualInstead of sysdate use your date column and group by the expression.
    Added example using Dave's test data
    WITH t AS
            SELECT TO_DATE ('9/5/2006 8:38:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   2 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 8:38:44 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   4 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 8:40:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   1 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 8:41:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   3 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 8:52:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   6 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 9:02:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   5 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 9:04:24 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   3 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 9:08:26 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   4 num
              FROM DUAL
            UNION
            SELECT TO_DATE ('9/5/2006 9:10:28 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
                   6 num
              FROM DUAL)
    SELECT   SUM (num), trunc(tm) + trunc((tm - trunc(tm))*24*2)/24/2 halfhours
        FROM t
    GROUP BY trunc(tm) + trunc((tm - trunc(tm))*24*2)/24/2;
    Row#     SUM(NUM)     HALFHOURS
    1     16     09.05.2006 20:30:00
    2     18     09.05.2006 21:00:00Message was edited by:
    Sven Weller

  • How to Get Missing Dates for Each Support Ticket In My Query?

    Hello -
    I'm really baffled as to how to get missing dates for each support ticket in my query.  I did a search for this and found several CTE's however they only provide ways to find missing dates in a date table rather than missing dates for another column
    in a table.  Let me explain a bit further here -
    I have a query which has a list of support tickets for the month of January.  Each support ticket is supposed to be updated daily by a support rep, however that isn't happening so the business wants to know for each ticket which dates have NOT been
    updated.  So, for example, I might have support ticket 44BS which was updated on 2014-01-01, 2014-01-05, 2014-01-07.  Each time the ticket is updated a new row is inserted into the table.  I need a query which will return the missing dates per
    each support ticket.
    I should also add that I DO NOT have any sort of admin nor write permissions to the database...none at all.  My team has tried and they won't give 'em.   So proposing a function or storable solution will not work.  I'm stuck with doing everything
    in a query.
    I'll try and provide some sample data as an example -
    CREATE TABLE #Tickets
    TicketNo VARCHAR(4)
    ,DateUpdated DATE
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-01')
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-05')
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-07')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-03')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-09')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-11')
    So for ticket 44BS, I need to return the missing dates between January 1st and January 5th, again between January 5th and January 7th.  A set-based solution would be best.
    I'm sure this is easier than i'm making it.  However, after playing around for a couple of hours my head hurts and I need sleep.  If anyone can help, you'd be a job-saver :)
    Thanks!!

    CREATE TABLE #Tickets (
    TicketNo VARCHAR(4)
    ,DateUpdated DATETIME
    GO
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-01'
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-05'
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-07'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-03'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-09'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-11'
    GO
    GO
    SELECT *
    FROM #Tickets
    GO
    GO
    CREATE TABLE #tempDist (
    NRow INT
    ,TicketNo VARCHAR(4)
    ,MinDate DATETIME
    ,MaxDate DATETIME
    GO
    CREATE TABLE #tempUnUserdDate (
    TicketNo VARCHAR(4)
    ,MissDate DATETIME
    GO
    INSERT INTO #tempDist
    SELECT Row_Number() OVER (
    ORDER BY TicketNo
    ) AS NROw
    ,TicketNo
    ,Min(DateUpdated) AS MinDate
    ,MAx(DateUpdated) AS MaxDate
    FROM #Tickets
    GROUP BY TicketNo
    SELECT *
    FROM #tempDist
    GO
    -- Get the number of rows in the looping table
    DECLARE @RowCount INT
    SET @RowCount = (
    SELECT COUNT(TicketNo)
    FROM #tempDist
    -- Declare an iterator
    DECLARE @I INT
    -- Initialize the iterator
    SET @I = 1
    -- Loop through the rows of a table @myTable
    WHILE (@I <= @RowCount)
    BEGIN
    --  Declare variables to hold the data which we get after looping each record
    DECLARE @MyDate DATETIME
    DECLARE @TicketNo VARCHAR(50)
    ,@MinDate DATETIME
    ,@MaxDate DATETIME
    -- Get the data from table and set to variables
    SELECT @TicketNo = TicketNo
    ,@MinDate = MinDate
    ,@MaxDate = MaxDate
    FROM #tempDist
    WHERE NRow = @I
    SET @MyDate = @MinDate
    WHILE @MaxDate > @MyDate
    BEGIN
    IF NOT EXISTS (
    SELECT *
    FROM #Tickets
    WHERE TicketNo = @TicketNo
    AND DateUpdated = @MyDate
    BEGIN
    INSERT INTO #tempUnUserdDate
    VALUES (
    @TicketNo
    ,@MyDate
    END
    SET @MyDate = dateadd(d, 1, @MyDate)
    END
    SET @I = @I + 1
    END
    GO
    SELECT *
    FROM #tempUnUserdDate
    GO
    GO
    DROP TABLE #tickets
    GO
    DROP TABLE #tempDist
    GO
    DROP TABLE #tempUnUserdDate
    Thanks, 
    Shridhar J Joshi 
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Get the Count for each row

    I'm trying to get the count for each row to total count for each month
    Something like this
    Hardware     |      Jan
    Monitors       |       5
    Processors   |      137
    Printers        |      57
    etc........
    How can I write a query for this. I can get the Hardware column but don't know how to get the next column.

    If you can provide more data like sample input DML statements it would have been wonderful..
    Assuming is , you need a pivot. Here is an article on basic Pivot..
    http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
    something like this may be..
    DECLARE @Input TABLE
    Hardware VARCHAR(20),
    [Date] VARCHAR(20)
    INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
    , ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
    ;WITH CTE AS
    SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
    SELECT *
    FROM
    SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
    PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • Qry:How to get different price for each price list (variable area) in order

    1-How to get different price for each price list (variable area) in order for sale. for the opportunity to display and select multiple prices.
    2- I add a location store from a table in line item and I want to see this area in order,.
    I 'm created 2 field location(item line and order), 1 table location
    I tried this for exemple : select $ [userfieldlocation.OITW]

    Thanks Suda for your answer,
    the Formatted Search for prices is OK, but for the Item locations in warehouse this is not so simple,     
    I must have several (at least 2) locations for the item in the Warehouse and a track of this location and search possibilities.
    read carefully and imagine how (Management warehouse locations)
    I added a user table '@Location' who linked to a user field 'U_Location in Item master data --> lnventory data  line and an ather user field 'U_Location' in sales order
    I met the value of location in the table (list of locations for any warehouse), I select the location of each item while receiving merchandise in the user field of inventory data line (Item M data) and this value appears in the sales order 'U_Location' user field ( only the location value in the default warehouse for this Item)
    or
    create an user field 'location' in Good receipt PO to fill it while receiving merchandise that appears in the sales order to give possibility to find/select the location of the item at this order and in Item master data
    I think we will use all these tables
    @LOCATION
    PDN1
    OITM
    OITW
    OWHS
    RDR1
    Juste a another question : where you found this and What is: ' 38.1.0 '
    Is it in document (System information):Item=38 Pane=1 ??
    Thanks,
    Ouchen

  • How to get automatically sysdate in a field

    How to get sysdate automatically in a field in ADF

    As provided in the above blog post provided by Branislav,
    use the groovy expressions for defaulting the date using the following expressions is the right & recommended approach:
    Only date: adf.currentDate
    Date with Time: adf.currentDateTime
    see section 3.6.1 in ADF Developer's guide:
    http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcintro.htm#CEGJJJBA
    Thanks,
    Navaneeth

  • Multi Mapping : How to get Message count after splitting

    Hi all,
    I am following below blog.
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    Can any body please tell me how to get the count of messages generated after splitting in the message mapping.. I have created the message data type but not aware what is needed to be done.
    Thanks and best regards,
    Kulwant Singh

    Multi mappings r done in order to split the messages to the number of messages required by the user. So for 1:N mapping, the details about "N" is based on ur requirement. So its not like - when u split, any number of message could get created. The count would be dependent on u.
    Regards,
    Prateek

  • How to get wage type for every time record

    Hi Pros,
          I am using DS 0CA_TS_IS_1, it includes report time type (0REPTT), but not have wage type. in CATSDB, I fied fields for attendance/absence type and wage type. but not every time record has wage type. can you please tell me how to get wage type for every time record? what is relation between reporting time type, attendance/absence type and wage typs?

    Hello,
    Can you talk to your HR/T&E functional consultant if they populate these values in CATSDB table using standard way or if there are custom fields that are in CATSDB OR any other table which can be used to meed the requirements
    Thanks
    Abhishek Shanbhigue

  • How to get file count in variable?

    dear all,
    how to get file count in variable?
    regards
    Naseer

    Hi Nazeer ,
    It wont take much time .. so simple :- )
    Create one os comand step
    ( for unix) Use
    wc -l filename.txt > someoutputfile.txt
    Now the number of lines in your file will be there in the output file ( someoutputfile.txt )
    Step2 :-
    Now use Cezar's logic to fetch the variable value ( file count ) from the output file .. ( select value for a variable from a file )
    This will not take eeven a second to finish the job.
    Regards,
    Rathish A M

  • How to get Page Count of pdf in Document library in EventHandler

    Hi,
    How to get Page Count of pdf in Document library once uploaded has been done and i would like to update the page count value in document library column of the corresponding file.
    I should achieve it in Event handler.
    Which even should i use, either ItemAdded or "ItemUpdated "?
    Thanks & Regards
    Poomani Sankaran.

    Hello,
    If you are looking for file download or view count then event handler will not work. You need to enable the analytic report to your site. Once you enable it then you can see the report within a browser or you can also create custom webpart to show count
    of specific file.
    http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx
    http://sharepoint.stackexchange.com/questions/34611/count-of-files-under-a-folder-in-a-document-library
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for

  • After 13 years, can no longer recommend HP - Chronic MB problems on dv6t-7000 unheeded by HP support

    I couldn't find anywhere else to voice this - my dv6t-7000 is just out of warranty and thus I don't qualify for email support. I have spent the past year in a back and forth battle with HP customer support and am finally calling it quits after 13 yea

  • Dynamic Names for the Outputs

    Hi, I was wondering if it would be possible to name the PDF outputs dynamically? Say for example, I have a tag in the XML <TemplateName>ABC</TemplateName>. Can I have the output PDF with the name 'ABC'? And Is it possible to explicitly specifiy the n

  • Draw lines in AdvancedDataGrid header

    Hi all,               I want to draw a vertical line in AdvancedDataGrid column header.               Can any one bring me in to that way. Thanks in advance

  • Client Content Question.

    Calling to any web designers... I have just started selling websites and one client has just sent me some PDFs and images and basically said 'sort it'. How do you all obtain content? I'm thinking if I give them a sort of sitemap explaining what I nee

  • Sava Data back to online datasource

    Hi,I will like to build an app that can pull and save user input along with other data online. Can you share some light as to if this is possible using the services and which services if possible...Thanks