Working with Date

Hello:

I need to calculate the use of 30 days from the date of activation. I have a table as below:

ACTIVATIONUSERITS USEUSAGE_DATE
08/05/2013ROB2008/07/2013
08/06/2013HANS5008/07/2013
08/06/2013MIKE008/07/2013
08/05/2013PIETER3008/07/2013
08/05/2013ROB9008/09/2013
08/06/2013HANS5508/11/2013
08/05/2013ROB7013/08/2013

I have to start with the activation date, assume that Rob is the 5 August 2013 activation date. Now, it is necessary to calculate all the use of 5 August 2013 to 03-SEP-2013. There is total USAGE_DATE 3 found for ROB with the 30 day limit. Thus, the output will be 180. You can find the end date using the USAGE_DATE column.

Output:

ACTIVATIONUSERTOTAL_USAGE
08/05/2013ROB180
08/06/2013HANS105
08/06/2013MIKE0
08/05/2013PIETER30

Please help me with the code.

Thank you/Tequila

Hello

Looks like you need a WHERE clause to compare usage_date of activation:

SELECT activation

, username - USER is a built-in function, not a column name good

SUM (use) AS total_usage

Of a_table

Activation where the usage_date BETWEEN

AND activation + 30

Activation of GROUP BY

user_name

;

Tags: Database

Similar Questions

  • Working with date and time of the request for help from acrobat JavaScript...

    This coming from

    Working with date and time in Acrobat JavaScript (part 1 of 3)

    The following code adds five days to the current date, and then prints the new date in the console window.

    Get the date and time

    var rightNow = new Date();

    Get the value of millisecond

    Article date

    var msRightNow = rightNow.getTime ();

    Calculate in milliseconds, of 5 days

    5 days x 24 hours/day x 60 min / h x 60 s / min x 1000 ms/s

    Challenge of var = 5 * 24 * 60 * 60 * 1000;

    Do the calculation of var CFAbsoluteTime = msRightNow + challenge;

    Create a new Date from the calculated value

    var theNewDate = new Date (finalTime);

    In the actual work on a form code, you'll want to place the

    the object of a field value. But since this is test code, we will

    Print the result to the Console window (great for debugging)

    Console.println ("5 days from now is:" + theNewDate.toString ());

    The foregoing is the exact code (cut and paste)

    The error I get here is;

    ReferenceError: theNewDate is not defined

    1:Console:exec

    undefined

    To get the "undefined" question a lot... it seems to me, learn to distinguish the undefined 'of type' undefined 'variable' and undefined 'value '.

    in this case 'theNewDate' seems to be defined as a variable equal to the current date plus 5 days... BUT I am now "educated" enough to 'see' Why am I getting the error...


    Any thoughts... Any who...

    You need to highlight all the text that you want to run.

    You have not set the rightNow variable before you can apply a method to the variable.

    You can just add a new variable as msRightNow name. Why not use rightNow.

    Executes the code that you provided with a new departure of Acrobat, I get the following error messages:

    rightNow.getTime is not a function

    1:Console:exec

    TypeError: rightNow.getTime is not a function

    1:Console:exec

    undefined

    What you are showing probably works because your previous attempts have left behind them a variable "rightNow" and as long as you do not have the object of time date change too much, you will not notice the error.

    Cleaning of your code:

    get the number of milliseconds of the date object.

    rightNow var = (new Date()) .getTime ();

    define 5 days in milliseconds;
    Challenge of var = 5 * 24 * 60 * 60 * 1000;

    Add 5 days to the value of this moment and assign the result to the last time;
    var CFAbsoluteTime = rightNow + challenge;

    convert finalTime value in a date object.
    var theNewDate = new Date (finalTime);

    display the result;
    Console.println ("5 days from now is:" + theNewDate.toString ());

    Have you tried the code that I provided, it is another way to add days to the date object.

  • working with date formatting issue

    Hi all
    I have a simple question, if I let say that I need to select all the lines more older then 7 days I can do:
     
    mdate defined like date;
    select * from table where mdate < sysdate - 7; 
    It's simple and fine wors, even if you move one month in return. It substrucs exactly 7 days keepins even time. I can use trunc (sysdate)-7 if I want to be defined by the time too. Therefore, save enough to use?

    I n ' understand why I see in many places, including the www code as example below which includes series for the conversion of/to_char to_date, is something wrong with the code above, I have little new to Oracle and proably I'm something you wish. Or using INTERVAL, is intended to preserve something, or...
    I understand that the value of both sides of > should be in the same format (present in my case).
     
    select * from table where mdate < to_date( to_char(sysdate, 'dd-mon-yy hh24:mi:ss'), 'dd-mon-yy hh24:mi:ss');
    I'm on Ora g10, probably this example should be used for older versions?

    Thank you
    Trento

    Trento wrote:
    Hi all
    I have a simple question, if I let say that I need to select all the lines more older then 7 days I can do:

    
    mdate defined like date;
    select * from table where mdate < sysdate - 7; 
    

    It's simple and fine, dot it substrucs exactly 7 days keepins even time. I can use trunc (sysdate)-7 if I want to be defined by the time too.

    I n ' understand why I see in many places, including the www code as example below which includes series for the conversion of/to_char to_date, is something wrong with the code above, I have little new to Oracle and proably I'm something you wish. Or using INTERVAL, is intended to preserve something, or...
    I understand that the value of both sides of > should be in the same format (present in my case).

    
    select * from table where mdate < to_date( to_char(sysdate, 'dd-mon-yy hh24:mi:ss'), 'dd-mon-yy hh24:mi:ss');
    

    I'm on Ora g10, probably this example should be used for older versions?

    Thank you
    Trento

    This has nothing to do with the version, well, maybe the version of the coding person :)

    Some people do not understand or have not been taught that a date holds no specific format so they think that this kind of manipulation is necessary, it is not.

    So, the code YOU have is good... the code you are questioning is not (I consider code unnecessarily making conversions 'bad').

  • How can I work with dates?

    I tried several formcalc and javascript methods, but none of them have worked for me so far.  What I want to do is take the current date and extract the month and year.   Then, I'll use these to test the function of other values.  An alternative is to build dates and compare them to the current date.  This date may be changed by the user after the form is displayed.

    In the code of pseudo-device it would look like this:

    currently on the minimum wage - current event is initialize

    MonthYear field is initially set to the current date, but can be changed by the user

    requiring that to happen again.

    var curDate = MonthYear;

    var prior10Date = ' 01/07/2010;

    var prior09Date = ' 01/07/2009';

    var minWage = 8.25;

    If (curDate < prior10Date) then

    minWage = 8.00;


    If (curDate < prior09Date) then

    minWage = 7.75;

    this.rawValue = minWage;

    Ahhh sorry, I didn't explain fully.  HelperFunctions is just a script object (right click on the node root the form and say "insert a script object".)  HelperFunctions, it's just what I named it.  You could call Jerry if you want) it's a bit like a javascript (.js) file where you can write a whole bunch of javascript functions just using as a reference anywhere on the form.  So if you have several fields that requires a formatted date of 01/09/2010 to September 1, 2010, you can do this by using a javascript function that you create.  For example:

    function convertDate (sDate) {}

    var month = sDate.substring (0, 2);

    var day = sDate.substring (4, sDate.lastIndexOf("/"));

    year = sDate.substring(sDate.lastIndexOf("/")+1 var);

    var monthSpelledOut = spellMonth (month);

    Return monthSpelledOut + "" + day + ', ' + year;

    }

    function spellMonth (month) {}

    {Switch (month)}

    case 1:

    return to "January";

    break;

    case 2:

    return "February";

    break;

    ...

    case 9:

    return "September";

    break;

    ....

    }

    }

    so now, no matter where in our form, we call convertDate (...) and pass on the date of our chain.

    Summary:

    A script object is just a collection of javascript functions to support you can call anywhere in your form by using the syntax:

    scriptObjectName.functionName (parameters);

    You can name the scriptObjectName everything that you want, (I chose HelperFunctions), and functionName may be something meaningful to you (I chose newDate() and setDate (mm, dd, yyyy);

    You will see in the area of the StateMinimumWage, the word is HelperFunctions.newDate () that goes to the HelperFunctions script object and calls the newDate() function returns the current date for me.

  • Values very strange when you work with dates

    Hello

    I'm new with oracle, and I have very strange values in a query that includes dates...

    This is the query...

    Select fechapermiso, sysdate - fechapermiso
    of permits;

    SYSDATE-FECHAPERMISO FECHAPERMISO

    JUNE 1 09 31.676
    JUNE 1 09 31.676
    10 JUNE 09 22.676
    11 JUNE 09 21.676
    6 JUNE 09 26.676
    JUNE 5 09 27.676
    JUNE 5 09 27.676
    19 JUNE 09 13.676
    10 JUNE 09 730509.676
    JUNE 11 09 730508.676
    JUNE 27 09 730492.676
    JUNE 27 09 730492.676
    JUNE 22 09 730497.676
    JUNE 22 09 730497.676
    JUNE 22 09 730497.676
    JUNE 29 09 730490.676
    JUNE 27 09 730492.676
    JUNE 27 09 730492.676
    JUNE 22 09 730497.676
    JUNE 22 09 730497.676
    JUNE 24 09 730495.676
    JUNE 22 09 730497.676
    JUNE 24 09 730495.676
    JUNE 24 09 730495.676
    JUNE 24 09 730495.676


    Why am I getting all these huge values?

    Published by: user9521601 on July 2, 2009 12:19

    Hello

    Here's the dates to the first century (1-100 years).
    Appararantly, someone came in 2-digit date in an incorrect format.

    To turn them all on the corresponding date in the 21st century, add months 24000:

    UPDATE  permisos
    SET     fechapermiso = ADD_MONTHS ( fechapermiso
                                 , 24000
                          )
    WHERE     fechapermiso >= DATE '0001-01-01'
    AND     fechapermiso <  DATE '0100-01-01';
    

    Published by: Frank Kulash, July 2, 2009 15:31

  • Smart album does not work with dates

    So, I live in Denmark, where the date is given as follows:

    1/12 2015 (1. of December 2015)
    This is supported on my mac, and there's nowhere where on my mac or one of my devices, as this date, 1/12, is considered to be January 12.

    But in the Photo, where I can choose up to 31 in the first slot and only up to 12 in the second, it still counts as if I had chosen January 12, when 1/12 is selected, on 12 February, 2/12 is selected and, in any other use, he chooses to interprit my choice as if I had used the American system. Only when, for example, any number of more than 12 years, in the first place, is selected, he remembers that I do, infact, use the Danish system of date.

    .. .and I do not know how to solve

    It is a pain!

    report to Apple - http://www.apple.com/feedback/photos.html - only they can fix a problem in tehsoftwre

    LN

  • Confusion with data sources / recordsets... ??

    I used to use Dreamweaver very strongly.  It has been a while, however, and now I'm loading up an old project that has been entirely developed "the way Dreamweaver" with games records and the use of extensions such as WebAssist gap.

    I opened Dreamweaver CC 2015.3 and I'm not finding anything on the Server Anywhere behaviors as I expected.  When I opened my pages that have the recordset data on them, or the shopping cart data, etc. I don't see all the windows of any place showing me that the data the way I used to see.

    I did a quick search in the help documentation and he said I should see a Panel under window-> links links, but I have no connections.  Don't know why... ??

    I did some digging and found a thread where it said that I had to install an extension, and it points me to a path for Windows Vista / Windows 7: C:\Program Files (x 86) \Adobe\Adobe Dreamweaver CC\Configuration\DisabledFeatures

    I'm on Windows 10, however, and I do not have a DisabledFeatures folder to the suggested location.

    I'm also confused why this would be an extension at this point... ??  Recordsets has been one of the most powerful features of Dreamweaver (I thought).  How am I supposed to my configuration database connections and to create and manage the data of the database now?

    More importantly, how do I get my old project works in the same way that he used?

    Any information on this would be greatly appreciated.  Thank you!

    Adobe dropped their Director Extension of development in 2015.

    Here are 3 freebies that you can use to install 3rd party extensions.  I used all the success.

    Anastasiy extensions Manager

    http://install.anastasiy.com/

    The seven extensions of the project manager

    http://www.Projectseven.com/extensions/

    The DMX Zone extensions Manager

    http://www.DMXzone.com/go/22670/DMXzone-extension-manager-for-Dreamweaver

    Replace deprecated server behaviors with a modern commercial extension:

    To work with data Dynamics and PHP, you need a local test server.

    See setting up a PHP environment in Dreamweaver

    http://www.Adobe.com/devnet/Dreamweaver/articles/setup_php.html

    Nancy O.

  • How to generate the display of mobile list with data of the user

    I try to develop a simple mobile application (mobile jquery) in Dreamweaver.

    I want to create a list of names of people from entering information via a form.

    The list would then be based on criteria that is last name or Department

    This require additional database programming or it is part of jquery mobile?

    I know it sounds simple, but I'm not a programmer, so I'm just my feet wet here.

    Thank you

    DW has no capability of database currently.  If you do programming server side with PHP and MySQL, there are commercial extensions, you can buy separately from the Web help and area of DMX.  But it's all depends on you how to work with data MySQL & PHP.  Development of applications for mobile devices is still a different learning curve.  I think DMX Zone has some extensions to help with that as well.

    http://www.DMXzone.com/go/32214/mobile-app-development/

    Nancy O.

  • I recently updated my iPhone to iOS 9.3 6s and now my data and wifi are in place. Now I can't open the apps and send messages with data and barely on the wifi. I've tried everything, and it still does not work.

    I updated my iPhone to iOS 9.3 6s today and now my data and wifi are in place. Whenever I try to open an app or send text messages with data it does not at all. And with wifi, it just works. I tried just like turn roaming off and off and other lte but nothing seems to work at all. Can someone please?

    I have this same problem too, it really gets me upset

  • How Siri works with a hotspot wifi phone from ATT without data?

    How Siri works with a hotspot wifi phone from ATT without data? I have the hotspot & it recognizes my iPhone5c, but Siri cannot find a connection when I use it. My phone service is now but only phone at & t imessage. No data, unpaid for the text. It works fine on my home WiFi & works but not the hotspot.

    Siri requires an Internet connection

    It will not work without one

  • Cipher.exe to overwrite the data deleted in Windows works with Windows Vista?

    Cipher.exe to overwrite the data deleted in Windows works with Windows Vista? He worked under Windows 2000, but not sure about Vista!  Otherwise Vista contains a command to clean free space HDD?

    Hello

    you need 3 of third party programs to clean free hard drive space

    For your question:

    always check the compatibility of vista programs on the link below

    http://www.Microsoft.com/Windows/compatibility/Windows-Vista/default.aspx

    If a program is compatible with vista you can try right click on the setup.exe, and then selecting run as administrator

    It is not compatible with vista, you can try running it in a previous operating system mode

    This does not work for all programs

    read the information below

    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-compatibility-mode/

  • I work with CS6 on PC. Since yesterday, I can't print my old data. But I can print a new one, I created since yesterday.

    I work with CS6 on PC. Since yesterday, I can't print my old data. But I can print a new one, I created since yesterday.

    What happens when you try to print?

    Photoshop returns an error message?

    Please make sure that your drivers are up-to-date.

    Kind regards

    Assani

  • What I see if I work with Microsoft and exchange of data on the creative clouds with people working on Apple?

    What I see if I work with Microsoft and exchange of data on the creative clouds with people working on Apple?

    That all depends on what you want to share

    The data files that are "industry standard" such as the JPG images are the same on both platforms

    Files that are specific to the platform, such as video files on a Mac or Windows, AVI video files MOV will either require conversion or additional software (to open a MOV file with a Windows program, you must have installed Apple Quicktime for Windows)

    In addition to this, the files that are specific to Adobe... such as the InDesign files... are not always compatible because of new features in newer versions, like a Premiere Pro video project file created in the 2015 version cannot open in 2014 version

    If you have problems with files and specific programs, you should ask for help in the forums for these programs

    If you start the https://forums.adobe.com/welcome Forums Index

    You will be able to select a forum for the specific Adobe products you use

    Click on the symbol "arrow down" on the right (where it is said to see all our products and Services) to open the drop-down list and scroll

  • I need a culture customized for my site, I work with a minority language, and I need to have calendar dates in this language. Is this possible with a widget in Muse?

    I wonder if there is no way to do a culture customized for my site hosted with BC's domain? I work with a minority language, and I need to have calendar dates in this language.

    Is this possible with a widget in Muse? -to change my language in this particular calendar, t.i.: may is in my language, and Monday is my language

    This stuff is usually coded in the underlying JavaScript widget, derived from locale hard your computer or browser / language setting or gleaned from the respective server configuration information, so most likely, it can not be done, if not already covered by one of these methods. Hacking jQuery would of course always possible, but the other options are beyond your control, anyway.

    Mylenium

  • VmWare data recovery and work with independent labels

    I read on a forum: If you want to drive the snapshot of the virtual machine is not affected, in its properties, select the "independent". Moreover, if the virtual computer is 'Independent' disks, the snapshot cannot be included in his memory.

    There was a question if the readers to all virtual machines 'Independent', would work "VmWare Data recovery?

    I'm not sure about my discoveries. SO please don't take this as a solution to your problem. My conclusions are:

    When you start to take a vDR of backing up a virtual computer that is configured with an independent record, it will not be successful. As vDR is used to take a snapshot in order to perform the backup of a virtual computer. If the capture is here, Independent disks prevents taking snapshot.

    -GaneshNetworks-

Maybe you are looking for

  • Satellite Pro A60 EN does not start after you have used the recovery CD - isapnp.sys missing or damaged

    Help am stuck with it. Necessary to perform a recovery on the laptop and used the recovery CD 2 they seem to work OK. No error during installation, but after that they finished and it restarts didn't get the following message. Windows could not start

  • I can't remove this app?

    A little explanation first: someone I know helped me (well supposed to help me I don't think he did much except use storage space) he was trying to help me and downloaded an app on my computer. Recently, I decided that I don't want this app on my com

  • How to use the USB for adminstator password reset / need to update Java

    I need to update java NOW.  However; I don't know my password.  I tried to use a USB key, but it did not work.  I need simple, clear directions on how to reset my password.   I need to update JAVA NOW.  Thank you

  • problems with my keyboard and MOUSE COMBO

    You just bought a logitech mk320 keyboard/mouse wireless combo... but I am unable to get a few (e-mail) access keys to work... logitech says it's the fault of Ms.  HELP * address email is removed from private life *... controlled my combo, return the

  • key recovery windows without order number 8

    I indeed two days there was recently a problem with window 8, I had upgraded to the offer and received the product key for windows 8 and windows media on my account hotmail around January 2013. In any case I had to take the option restore window 8, d