Checking Frequency of a record

I have a table that has information about customer payments per day. Now I want to extract the information on which clients made a payment everyday, for the past month. I have an oracle 11g Database.
Edited by: user12184158 on Jul 26, 2012 2:07 AM

user12184158 wrote:
Below is the table structure, sample data and expected output. Note that only custid 300 is in output since he contributed something everyday i.e on the 1 and 2 and 3So you don't want every day in the month, only the days that are actaully in the table, related to some custid.
For example, custid='400' has no data for June 2, but other custids (such as '300') do have data for June 2, therefore you don't want custid='400' in the results.
Custid='300' has no data for June 4, but that's okay, because no other custid has data for June 4, either.
Do I have it right?
CREATE TABLE customerpaytab
SERIALNUMBER NUMBER,
BATCHNUMBER  NUMBER,
CUSTID       VARCHAR2(20 BYTE),
paiddate DATE,
AMOUNT NUMBER
insert into customerpaytab values (55,2,'300','1-Jun-2012',5); ...
Paiddate is a DATE, so don't try to insert a VARCHAR2 value, such as '1-Jun-2012' into it. Use TO_DATE or a DATE literal instead.
sample output
custid,sum(amount)
300,15Here's one way:
WITH     alldates     AS
     SELECT DISTINCT
             TRUNC (paiddate)                    AS adate
     ,          COUNT (DISTINCT TRUNC (paiddate)) OVER ()     AS datecnt
     FROM        customerpaytab
     WHERE     paiddate     >= ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH'), -1)
     AND     paiddate     <               TRUNC (SYSDATE, 'MONTH')
SELECT       p.custid
,       SUM (p.amount)     AS totalamount
FROM       customerpaytab  p
JOIN       alldates       a  ON  a.adate  = TRUNC (p.paiddate)
GROUP BY  p.custid
HAVING       COUNT (DISTINCT TRUNC (p.paiddate))     = MIN (a.datecnt)
;If the time of paiddate is always 00:00:00, then you can say "paiddate" instead of "TRUNC (paiddate)".

Similar Messages

  • How to check the master data records in using SE16 transaction?

    Hi,
    Can you please help me to check the master data records using SE16 transaction?
    Loaded master data for Characteristic and want to check the records in the master data tables.
    Thank you for your help!
    Lakshmi

    Hi!
    Welcome to SDN.
    you have to check the master data tables.
    soo in Se16 you have to select the appropriate master data table and view the data.
    following thread explains about masterdata tables
    MasterData table?
    regards
    mohan
    Message was edited by:
            Mohan Krishna

  • How to set the Charge's email checking frequency polling interval?

    HI.  Does anybody know the secret for setting the email checking frequency polling interval?  
    During setup I get two options:  Push and Never.     If I choose push I find no options for setting the check frequency to 15 min, 1 hour, etc......
    Am I missing something?    Would like to tune it to consume an optimal amount of battery.
    Thanks

    Hello LIRob,
    After testing on Droid Charge myself, yes the only options for changing "Email Check Frequency" are "Automatic (Push)" and "Never".  I know you mentioned you are wanting to conserve as much battery usage as possible, so I have included a link below with a short video that gives some tips & tricks on conserving battery on Samsung Charge.
    Tips and Tricks for Battery Conservation on Your Droid Charge by Samsung
    Hope this answers your question!

  • Err:This is a live client. No check performed against Control record. Payro

    HI Experts,
    When I am running Actual Payroll for first time in production  an error is coming
    "This is a live client. No check performed against Control record. Payroll Cancelled"
    Please advise.
    Regards,
    Tomesh

    Look at  Note 102777 - Running Payroll in Productive Client
    FYI
    Reason and Prerequisites
    A check on the control record is commented so you wouldn't acidentally
    run it productively and it is used for testing on payroll run in the
    productive client.
    Solution
    1. Goto PE01 and edit schema for your country. ie. DIN0, QIN0...
    2. Remove the comment '*' for the line CHECK ABR.
    ^ Saquib

  • Please check the LIVE CHAT Record and return my money back.

    This is the situation.
    My 2-year contract ended on 1-15-2015, and I ordered a new device iphone 6 plus (64G) on 1-13-2015 and selected Edge plan (I line, 1GB data, unlimited call and message from 1-15-2015, totally price $80/ month). I had a live chat with a lady and a man, and also confirmed it with call. 
    Now I found that the bill became $183 !!!  6GB data is stead of 1GB. The stupid thing is that I paid the same amount ($183) last month as I thought first month charged more because of handing fee.... Now this month It also 183. So I contact with LIVE chat person and ask them to check the LIVE CHAT record to compensate the losses. They told me that they can't enter the record and can't make this remedy. 
    So, why do I need take resposible for this mistake? Why do I need pay $200 more? Why can't your guys see the record and find the evidences? Actually I only use 20% data of 1GB, why you HELP me order 6GB? 
    Solved!
    Go to Solution.

    Welcome to the forums.  You're talking to other users here.  Further, your talking to users of Verizon's fixed location residential services including FiOS, DSL and telephone.  Your issue is with Verizon Wireless.  Visit their web site for support options.
    http://www.verizonwireless.com/
    Good Luck.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.

  • How can save only the checked values in a record as a string?

    I have a question on form where the user can choose multiple checkboxes. Due to the type of form that it is there will only be one record written. I am using Access as a comprehensive form as opposed to a database in this instance.
    Once industry submits this application (form) to us I upload some data to Oracle database which works fine. Now, I need to upload some of the data to a workflow software. I figured out how to do everything except the following:
    In this record there are over 20 checkboxes. Each check box has a name/Record source such as SA (Surface Area), SC (Surface Contour), SS (Sleep Slope), ect. The user will select several of these checkboxes. I need to look at each chk box field. If the value
    = true, write the fullname of each field to a table as a string with each field seperated with a comma. For instance,
    If SA, SC and SS were checked on the form Surface Area,Surface Contour,Sleep Slope would be added to the Procedure_Value field in a table (see function ExportTable). Next I convert the table into a text file
    Function ExportTable
    dim rst As DAO.Recordset
    dim strSQL1 As String
    strSQL1 = "SELECT tblExport1.* FROM tblExport1;"
    Set db = CurrentDb()
    Set rst = db.OpenRecordset(strSQL1, dbOpenDynaset)
    With rst
    .AddNew
    rst!Procedure_Value = "Surface Area,Surface Contour,Sleep Slope"
    .Update
    End With
    rst.Close
    Set db = nothing
    Set rst = nothing
    End Function
    jim neal

    If I understand you correctly you have one table with a bunch of yes/no values (SA, SC, SS, etc.).  Then for each record in that table you want to output a string listing all the fields from the first table which = yes (i.e are checked).  Perhaps
    the following code would get you started:
    Sub JimNeal()
        Dim strProcedure_Value As String
        Dim rst As DAO.Recordset
        Dim rstOut As DAO.Recordset
        Set rst = DBEngine(0)(0).OpenRecordset("TableWithCheckboxes")
        Set rstOut = DBEngine(0)(0).OpenRecordset("OutputTable")
        Do Until rst.EOF
            strProcedure_Value = ""
            If rst!SA Then strProcedure_Value = strProcedure_Value & "Surface Area,"
            If rst!SC Then strProcedure_Value = strProcedure_Value & "Surface Contour,"
            '... etc
            If rst!SS Then strProcedure_Value = strProcedure_Value & "Steep Slope,"
            rst.MoveNext
            ' Strip off final comma
            If Len(strProcedure_Value) > 0 Then strProcedure_Value = Left(strProcedure_Value, Len(strProcedure_Value) - 1)
            ' Output the string to your output table
            rstOut.AddNew
            rstOut!Procedure_Value = strProcedure_Value
            rstOut.Update
        Loop
        rst.Close
        rstOut.Close
        Set rst = Nothing
        Set rstOut = Nothing
    End Sub
    -Bruce

  • Extractor checking for 2LIS_02_SCL = 0 records selected

    When I try to check extraction (in RSA3) for 2LIS_02_SCL I get "0 data record selected" even if there is plenty of data (PO's) created. Could it be that the DataSource hasn't been actived?

    Hi Daniel,
    do you have the the authority now?
    Another reason is, that you might have not run a setup for application 02, so the setup tables are empty and you cannot extract any data during a full request.
    Let me know!
    regards
    Siggi

  • Validation check to see if Record already in database

    I want a validation rule that will eliminate duplicate records in the database. So I want to check to see if the Account number already exists in the database. I would check this when the CREATE button is pushed.
    Help with the query would be most appreciated.
    The ITEM Name is :P10_ACCT_NO
    The oracle select statement would be
    select acct_no from admission_review

    And don't forget to create a UNIQUE CONSTRAINT on acct_no. Because if you have two users who entering the same account no and press submit at the same time, both will pass the exists check. So you would end up having two records with the same account no in your table.
    The unique constraint checks makes sure that this wrong data doesn't go into the table in such a rare situation.
    Patrick
    Check out my APEX-blog: http://inside-apex.blogspot.com

  • Checking header and trailer record

    Hi
    Plz can any one guide me writing UDF for checking whether header record exists or not
    i am using node funtion Exits...
    In UDF i wanna check the value of Exists if it is true continue the process if it is false raise an exception
    How we write UDF for that
    venkat

    Hi.....Venkat,
    1.Import ur sender & reciever XSD files.
    2.A user defined function is created before doing the mapping where we write the java code to achieve the looping conditions.
    3.At the time of creating the function we should have two arguments (ex.a & b)(importing parameters) to it.then the java code is written for the conditions.
    4.write ur code.
    5. then using the user defined function further mapping is done.In this way the conditions are achieved during mapping.
    ******************if it helpful points will be rewarded*********************************
    Regards,
    Naresh.K

  • Check each and every record during update/delete

    Hi,
    I have forms 10g I made one tabuler form and want to apply certain restrictions like after two days update or deletes are not allowed how can I check this for each and every record in tabuler form during updation/deletion.
    2- If the record does not meet my criteria how can I skip saving/updating record.
    Thanks in advance.
    Khawar
    Message was edited by:
    S. Khawar

    As you already storing the data for created date/time, it’s quite easy now to check date/time before deleting or updating
    Need 2 triggers to write on the specific block.
    1)     PRE-INSERT
    2)     PRE-DELETE
    The Trigger code as follows in both triggers
    Declare
         No_Days Number;
    Begin
         Select Nvl(Trunc (Sysdate - Created_datetime),0)
         Into No_Days
         From <Table Name>
         Where :<Form Column Name> = <DB Column Name>
    If No_Days >= 2 then
    Raise Form_Trigger_Failure;
    End If;
    End;
    Cheers
    Ayaz

  • How to check/count whether child records with specific type exist?

    Hi
    We need to create a BIP report based on data from Siebel.
    In Siebel we have two entities:
    Entity <Mandate> = Parent Business Componet
    Entity <Attachment> = Child Business Component
    (An attachment has a specific type attribute (e.g. “contract”, “appendix” and lot of others…)
    Relationship between Mandate and Attachments is 1-m.
    We need to create a BIP report which displays all Mandates records which do not have at least two Attachments child records (there must be one attachment child record with type=”contract’ and another with type “appendix”). How can we check in BIP whether these child records with a specific Attachment type exist? And if not, display the Mandate in a list....
    Many thanks
    Alen

    Thanks for your help
    Well I'm not sure about the syatax I have to use in order to filter on the field *<GAMDocumentType>*
    The structure of the xml we use is as follows:
    <ListOfBipJbAmlMandateAttachmentReport>
    <JbAmlMandate>
    <ListOfJbAmlAttachment>
    <JbAmlAttachment>
                   <AccntFileName>DocumentPage_713328</AccntFileName>
                   <GAMDocumentType>*contract</GAMDocumentType>
                   <MandateId>1-4C79B</MandateId>
                   <Status>Active</Status>
    </JbAmlAttachment>
    I tried <?for-each:JbAmlMandate[count(./JbAmlAttachment[GAMDocumentType='contract']) > 1 and count(./Attachment[type='appendix']) > 1]?>
    But this returns nothing.
    Many thanks for your help
    Saggittarius

  • Check number sequence - previous record variable

    Post Author: rmhogan
    CA Forum: Formula
    I am trying to highlight a record that is out of number sequence with the previous record.  I am guessing that I need to create 2 variables (one for the current number and one for the previous number).  I cannot seem to get this to work.
    Any help would be appriciated.
    Example ....
    Check Number
    016000123
    016000124
    016000126 <--- out of sequence (I want to highlight this detail line)
    016000127

    Post Author: rmhogan
    CA Forum: Formula
    Thanks so much.  However, I am getting a error saying  ... "The formula result must be a number".  The fields are strings in the database, however I have converted the to numbers in a formula  &#91;tonumber() function&#93;.
    Any ideas.

  • Check Frequency Used on S60 5th edition (850 or 19...

    Hey,
    I have a nokia 5800 xpressmusic (unlocked USA version.) It runs S60 5th edition.
    I am considering getting a phone which only supports AT&T's 1900 mhz, and not their 850 mhz (it is primarily a European phone which also has 900/2100 mhz.)
    Without getting into a discussion on which phone to get, can anyone tell me how to check what frequency is in use on my 5800?
    Thanks,
    Mike

    There is no tool that I know of that will show which frequency is in use.  But I do know that in most major cities AT&T uses the 1900Mhz signal and they use the 850Mhz signal in rural areas.  The 850 towers are converted analog towers and the 1900 towers are dedicated digitals.  
    Using a Non US phone on AT&T's network, you will get Spotty to Good service in major cities (if the phone is a quadband phone) and limited to no service in rural areas.  Most of the time the Non US phone will be on AT&T free roaming networks most likely with T-Mobile(T-Mobile uses 2100Mhz in major cities); it will most likely say AT&T on the phone and you will not be charged a roaming fee.  I hope this helps.

  • While Checking In " Cannot remove record because it has links"

    Hi All,
    We have an scenario while checking In MDM records in Data manager showing the following error " Cannot remove record because it has links".
    There are 2 main tables Table A and B, both are look up main to each other.
    Record 1 from Table A is linked with 5 records in Table B and one of the record from Table B is linked to Record 1 of Table A
    All the Records from Table B is checked In. Now am Check-out Record 1 from Table A and trying to Check-In back, while performing the same am getting the following error  " Cannot remove record because it has links".
    Is this work as per the Look up main design or am I missing anything. Help appreciated.
    thanks,
    <ar>

    Hi Alex,
    Before removing record you need to remove links for those records. By this I mean you must have a field in Table A which is lookup to Table B and vice-versa. So firstly delete this field value which is a sort of relationship between these two tables and afterward only try to delete/remove record.
    Regards,
    Mandeep Saini

  • Checking usage of determination records

    How can I check whether two different packing instructions are using the same determination record?
    Thanks.

    It is the other way round, and the adequate table is KONDP.

Maybe you are looking for

  • CD/DVD Error Code 10 Device cannot start

    Tried to roll back the drivers, also tried uninstalling the drivers, need correct drivers for the device HL-DT-ST-DVDRAM GSA-T20L ATA DEVICE, shows that correct drivers are installed if I search windows for the correct driver.  Also tried system rest

  • Using Dreamweaver and Contribute at the same time

    Hello! I just installed the Adobe Creative Suite 3 Master collection and when I am using Contribute and try to edit the pages in dreamweaver by using the edit in external application an unknown error occurred in the contribute state manager. Could so

  • SMSY for ERP JAVA and ABAP Stack

    Hi Folks - I have installed SAP ERP 6.0 EHP5 in one database called T12. Now there is a need for a Java stack and I have installed the Java stack in another database called J12. I was able to define the ABAP stack on system landscape and MOPZ is work

  • Calendar in other languages

    Is it possible to have a build-in calendar display months in other languages? Thanks, Art P.S. I've got the show name option checked in but my name doesn't appear anyway

  • Shared photo stream / Config iPad 1 and iPhone 4

    I invite my sister to a photo stream. She has a iPad 1 running iOS 5.1.1 and a iPhone 4 running iOS 6. With the first invite everything was well. She could see the stream on the iPhone. One week later I sent her a new stream. No notification on the i