To find the last year data / data of the year an individual

Hello

How to find the data for the whole of last year, I tried like

entered_date between to_char (December 31, 2008 11:59:59 ', ' HH12:MI:SS MM/DD/YYYY ')
and to_char (1 January 2010 00:00:00 ',' DD/MM/YYYY HH12:MI:SS'), but it's an error invalid number.

Thank you.

Hello

If you want something that doesn't require you to hardcode a year, but the numbers automatically in what year it is:

WHERE   entered_date     >= ADD_MONTHS ( TRUNC (SYSDATE, 'YEAR')
                                          , -24
                                )
AND     entered_date     <  ADD_MONTHS ( TRUNC (SYSDATE, 'YEAR')
                                          , -12
                                )

There are a couple of things to notice on the expression that you posted (in addition to using TO_CHAR TO_DATE instead):

WHERE  entered_date     BETWEEN TO_DATE ('12/31/2008 11:59:59', 'MM/DD/YYYY HH12:MI:SS')
                      AND       TO_DATE ('01/01/2010 00:00:00', 'MM/DD/YYYY HH12:MI:SS')

BETWEEN includes two end points, so the phrase above covers just a little over a year. It includes a second of 2008 and a second in 2010, as well as the whole of 2009.

Currently, 2010 is the last year, so the expression you have posted (as well as my suggestion) is actually for the year before last year, but it can easily be changed for the whole year.

Tags: Database

Similar Questions

  • How to find "program last used date" W7 - works on XP & Vista

    Works in XP & Vista

    Used to be able to say when the last used program on in programs and features, and if it were not needed, I uninstalled the program.

    Added "last used on" field in "Control Panel, all the elements of Control Panel, program and feature, uninstall or change a program".

    Field never fills, some in W7 features must be turned on the fact?

    Is there another place to find the answer?

    If the program does not provide this information itself, add/remove programs is forced to guess.

    The problem is that there is no "obvious" way to map an entry in the Add/Remove Programs list on a real program. Each entry in the list, for those who are interested in these things, HKEY_LOCAL_MACHINE
    \Software
      \Microsoft
       \Windows
        \CurrentVersion
         \Uninstall
          \{ProductCode}
    . Required properties only for an installable program are the DisplayName property and the UninstallPath. Everything else is optional.

    http://blogs.msdn.com/b/oldnewthing/Archive/2004/07/09/178342.aspx

    -Raymond Chen [MSFT]-

    Windows confidential - the legend of uninstallation

    http://TechNet.Microsoft.com/en-us/magazine/gg558108.aspx

    "If the application does not record the information, Windows keeps the blank column.

  • How to find the list of individual songs in iTunes?

    I used to be able to find the complete list of songs in my iTunes. Now, all I see is a list of playlists on the left side. I can't find anyway to get it to list all of my songs. Only when I put in something again I see the song list in the item, such as an audio book, for example.

    I want to check my list to see exactly what I have, but can't see any song, unless it is in a playlist. How can I see a list of all my songs?

    In the sidebar under 'Library', a secondary to edit click the list that you see there. Add songs.

  • Get the date of each month in the last year

    Hi all

    I need to find the last date of the month for the year.

    Example:

    I used to spend the date or such year 2012 or 01-01-2012(DD-MM-YYYY)

    SQL query should return the last date of the month as

    31/01/2012

    28/02/2012

    31/03/2012

    30/04/2012

    .

    .

    .

    .

    .

    12/31/2012

    For more top the requirement that I wrote the SQL code following

    select rownum as row_count,
    case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Jan_month,
    case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Feb_month,
    case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as mar_month,
    case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as apr_month,
    case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as may_month,
    case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jun_month,
    case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jul_month,
    case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as aug_month,
    case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as sep_month,
    case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as oct_month,
    case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as nov_month,
    case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as dec_month
    
    
    from dual connect by level <= 12 order by rownum;
    
    
    
    
    

    Result

    Jan_MonthFeb_MonthMar_MonthApr_Monthmay_monthjun_monthjul_monthaug_monthsep_monthoct_monthnov_monthdec_month
    131/01/2014
    228/02/2014
    331/03/2014
    430/04/2014
    531/05/2014
    630/06/2014
    731/07/2014
    831/08/2014
    930/09/2014
    1031/10/2014
    1130/11/2014
    1212/31/2012

    Except the result:

    am result except as single line such as

    Jan_MonthFeb_MonthMar_MonthApr_Monthmay_monthjun_monthjul_monthaug_monthsep_monthoct_monthnov_monthdec_month
    31/01/201228/02/201231/03/201230/04/201231/05/201230/06/201231/07/201231/08/201230/09/201210/31/201230/11/201212/31/2012

    Kindly give me suggestion to archive more high result.

    Thanks and greetings

    Saami

    I agree with Marcus Pivot is the way to go on this subject... But on the other hand you almost solved yourself... it was just a max function for your results:

    ---------

    select
    max(case  when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Jan_month,
    max(case  when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Feb_month,
    max(case  when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as mar_month,
    max(case  when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as apr_month,
    max(case  when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as may_month,
    max(case  when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jun_month,
    max(case  when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jul_month,
    max(case  when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as aug_month,
    max(case  when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as sep_month,
    max(case  when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as oct_month,
    max(case  when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as nov_month,
    max(case  when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as dec_month
    from dual connect by level <= 12 order by rownum;
    

    AND to avoid hard-coding, you can also modify your query in the form:

    select
    max(case  when rownum=1 then last_day(to_date(to_char(rownum),'MM')) end) as Jan_month,
    max(case  when rownum=2 then last_day(to_date(to_char(rownum),'MM')) end) as Feb_month,
    max(case  when rownum=3 then last_day(to_date(to_char(rownum),'MM')) end) as mar_month,
    max(case  when rownum=4 then last_day(to_date(to_char(rownum),'MM')) end) as apr_month,
    max(case  when rownum=5 then last_day(to_date(to_char(rownum),'MM')) end) as may_month,
    max(case  when rownum=6 then last_day(to_date(to_char(rownum),'MM')) end) as jun_month,
    max(case  when rownum=7 then last_day(to_date(to_char(rownum),'MM')) end) as jul_month,
    max(case  when rownum=8 then last_day(to_date(to_char(rownum),'MM')) end) as aug_month,
    max(case  when rownum=9 then last_day(to_date(to_char(rownum),'MM')) end) as sep_month,
    max(case  when rownum=10 then last_day(to_date(to_char(rownum),'MM')) end) as oct_month,
    max(case  when rownum=11 then last_day(to_date(to_char(rownum),'MM')) end) as nov_month,
    max(case  when rownum=12 then last_day(to_date(to_char(rownum),'MM')) end) as dec_month
    from dual connect by level <= 12 order by rownum;
    

    Easy way: (without login)

    SELECT LAST_DAY (TO_DATE (ROWNUM, 'MM')) AS Jan_month,
           LAST_DAY (TO_DATE (ROWNUM + 1, 'MM')) AS Feb_month,
           LAST_DAY (TO_DATE (ROWNUM + 2, 'MM')) AS Mar_month,
           LAST_DAY (TO_DATE (ROWNUM + 3, 'MM')) AS Apr_month,
           LAST_DAY (TO_DATE (ROWNUM + 4, 'MM')) AS May_month,
           LAST_DAY (TO_DATE (ROWNUM + 5, 'MM')) AS Jun_month,
           LAST_DAY (TO_DATE (ROWNUM + 6, 'MM')) AS Jul_month,
           LAST_DAY (TO_DATE (ROWNUM + 7, 'MM')) AS Aug_month,
           LAST_DAY (TO_DATE (ROWNUM + 8, 'MM')) AS Sep_month,
           LAST_DAY (TO_DATE (ROWNUM + 9, 'MM')) AS Oct_month,
           LAST_DAY (TO_DATE (ROWNUM + 10, 'MM')) AS Nov_month,
           LAST_DAY (TO_DATE (ROWNUM + 11, 'MM')) AS Dec_month
      FROM DUAL
    

    See you soon,.

    Manik.

  • How to find the last date of execution of the objects in database

    Hi all

    We're going for an upgrade of the database 11g and for the same thing, we want to know the last date of the following-

    Packages, Tables, views
    Conc. programs / value Sets / look up / profile options

    Is there a way we can find the same thing.
    The answers would be really useful.

    Kind regards
    Shruti

    So can you provide clues on how to find the last opportunity registration

    I don't think you can find such a script with having activated audit.

    Thank you
    Hussein

  • How to find the sum of the month and year of a date

    Hi all

    I want to find the sum of the date
    for example, 10 November 2010 I need to find (11-2010).

    Please help me

    You can use the extract function...

    SQL> select extract(month from systimestamp)+extract(year from systimestamp) from dual;
                EXTRACT(MONTHFROMSYSTIMESTAMP)+EXTRACT(YEARFROMSYSTIMESTAMP)
                                        ------------------------------------------------------------
                                                            2021
    

    Concerning
    Renjith Malet

  • Find the last valid value in a date range

    The data I work with represents readings from different instruments. A follow-up field of a sum running while this number continues to increase. I need to look at the data for a particular date, but the problem is that sometimes the instrument is turned off. In this case there is no data for that date, however since all I want is the total sum for the signal on this instrument, I need to keep going until I find the latest valid data in the database that would represent the sum up to this point. How can I design a query or procedure that would deal with this eventuality? Some examples of data:
    PV_ID                  SMPL_DTE                  INTEG_SINCE_VAL 
    ---------------------- ------------------------- --------------- 
    271                    20-JUL-08 12.05.00 AM     6172.0387459767 
    271                    20-JUL-08 12.06.00 AM     6172.0387459767 
    271                    21-JUL-08 12.05.00 AM     6172.0387459767 
    271                    21-JUL-08 12.06.00 AM     6172.0387459767 
    271                    21-JUL-08 08.43.00 AM     6172.0387459767 
    271                    21-JUL-08 08.45.00 AM     6172.0387459767 
    271                    22-JUL-08 12.05.00 AM     6172.0387459767 
    271                    12-AUG-08 04.45.00 PM     6172.0387459767 
    271                    12-AUG-08 04.50.00 PM     6172.038748687284 
    So, if for example I run a query for July 30, I would need to get the result of the July 22 because it is the last valid number. PV_ID represents the ID of the instrument and the INTEG_SINCE_VAL of the total cumulative for signal readings on this instrument.

    Published by: Solerous on March 16, 2009 07:23

    Published by: Solerous on March 16, 2009 07:25

    Hello

    If you want the last row or before a given date of the target as on July 30, 2008)?

    Here's a way

    SELECT  *
    FROM    (
            SELECT    *       -- or whatever columns you want
            FROM      table_x
            WHERE     sample_dte < TO_DATE (:target_dte, 'DD-MON-RR') + 1     -- See note below
            ORDER BY  sample_dte DESC
            )
    WHERE   ROWNUM = 1;
    

    NOTE: the above query adds a day to the current deadline, but selects the lines that are less important (not equal to) that link, so if you enter 30 July 08, it compares against 31 July 08, so he would choose anything on the date target itself, no matter what time. In other words, if you ask 30 July 08, you could get something later than 30 July 08 23:59:59, but you wouldn't get 31 July 08 12:00:00 AM.

  • How to find the last update date, time and user of the file field peoplecode

    How to find the last updated date time fields of peoplecode records?

    Thank you.

    We can check the update date-time using the following query

    SELECT LASTUPDDTTM IN THE PSPCMPROG WHERE OBJECTVALUE1 LIKE "RECNAME" AND OBJECTVALUE2 AS "FIELDNAME".

  • How to find the difference in date in years, months and days

    Hello
    I need to find the difference between 2 dates in the following way "years months days". "
    Please can help me, how can I achieve this.

    for example, in the scott schema emp table, I need to find the difference in date between sysdate and hiredate for an employee in the following way.

    12 years 7 months 4 days.

    Hello

    Please, see this post to AskTom [difference between 2 dates | http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:96012348060]. There is good information in this forum, for example you can also see this thread [calculation of years, months & days | http://forums.oracle.com/forums/thread.jspa?messageID=3115216�]

    Kind regards

    Published by: Walter Fernández on November 30, 2008 08:58 - adding another link

  • How to find the value dated the same day in the last year

    I want to know how to find the value dated the same day in the last year.

    I use now, there is the function with the year and the result is

    Year Rev There are Rev
    20113000
    201240003000
    201320004000
    201450002000

    It works but it's not that I want. I'm trying to add the column date (Ex.20140101) in my report but it'snot work.

    I want to show:

    Date Rev There are Rev
    20110112200
    20120112100200
    20130112300100
    20140112500300

    If use (< degree >, < time_dim >. < date >, 365), it works but does not correct 100%

    Please help me...

    Thank you very much

    Check this link cool - bi.com

  • Import notes that in SOD - how to set the last-modified Date?

    We are still doing our Siebel users. We launched on-air, and therefore some users who were still using legacy systems while some worked far in Siebel. What I'm trying to do now is to take over from representatives in the old system and go to Siebel. I have the file created with the subject, external account id, note (description) and the date that the note was created in the old system. When I try to import the date cannot be set and is broken at the time of that creation of the acutal in Siebel note.

    It is a problem that I have 3 years of account history that should be loaded and if I import all of this now, it will push the notes in the system to bottom of the list who will be upset representatives began uisng Siebel in the first wave.

    My goal is simply to be ordered from oldest to newest on top, but I can't seem to find a way to do that using the tool of importation as a last modification Date is not an option for me to import.

    Is it possible to do? If not, anyone know of a work around to achieve the same goal?

    Any help is very appreciated.

    -john

    It wouldn't appear in the Notes section of the retail account. Currently, it is not possible to import the date as part of an import of Notes.

  • HP g62-340us: FIND THE DATE OF MANUFACTURE for a HP G62-340US?

    How to find the date of manufacture on my HP G62-340US

    Ken

    Hi, Ken

    This means that your laptop has built in 2011 (1) in the 2nd week of the calendar year (02) or January 2011.

  • I had a hard drive crash and had to move all the data again. Now, I get an error saying that my Visa is not an authorized version. How can I find the product key to reactivate?

    Vista Product Code question

    I had a hard drive crash and had to move all the data again.  Now, I get an error saying that my Visa is not an authorized version.  How can I find the product key to reactivate?  I don't have the sticker on the back and the software I have does not have the code?  I bought this laptop DELL at Best Buy a little more than a year.

    Thank you.

    Hello

    This problem may occur if you make a significant hardware change. See the link provided below.

    Error message when you start Windows Vista: "your activation period has expired".

    http://support.Microsoft.com/kb/925616

    If the OS came preinstalled Dell you may need to contact Dell technical support for assistance.
    http://support.Dell.com/support/topics/global.aspx/support/win7_support/win7_portal?c=us&CS=04&l=en&s=BSD

  • Using two dates to find the age...

    Hello

    I need to find the age of a person the DOB entered into service.  the age may be days or years depending on when the person was born.

    If the person was born is less than a year, so I should be able to calculate the number of days on the other, it should be over the years.

    I can't find the right way to do it.  I tried like this but its does not work as it should:

    todaysDate long = (new Date()) .getTime ();
    long date of birth = dobDateField.getDate ();

    long dateDiff = todaysDate - date of birth;

    multiply a day with 365 days (ignore the leap year for now)
    length of year = DateTimeUtilities.ONEDAY * 365;

    If (dateDiff< year)="">
    int NoOfDays = (int) (dateDiff / DateTimeUtilities.ONEDAY);
    ageEditField.setText (String.valueOf (NoOfDays) + "D");
     
    } else {}
    int NoOfYears = (int) (dateDiff/year);
    ageEditField.setText (String.valueOf (NoOfYears));
    }

    Help, please...

    int age = (diff / (1000 * 60 * 60 * 24));
    int years = 0;
    
    if( age >= 365 ) {
       years = age / 365;
    }
    
    if( years > 0 ) {
     // use years
    } else {
     // use days
    }
    

    Something like that.

  • I can't find the "date modified" by downloading files to websites

    When I try to upload files to various sites, I can't find the "change date". Usually, I have the 'update' so that the last file that I worked on is on the top of the list and I quikly find.

    I checked on three different sites and each of them, when I go to browse the file to download, the "modification date" don't appear in the search window, and I have to type the name of the file, or scroll through the file to find.
    I can't find the "change date".

    See if you can right click on a column label to find add columns.   Necessary in Windows Explorer.

    OK... found it... for some reason when I had it on large icons, he wasn't showing me it... i changed large icons for details... and when I right click I saw ' sort by ' and then 'update'... after I clicked on update he showed on the column.

    My last OS is Vista and it's always right there, or I had to top of the window to do a right click

Maybe you are looking for

  • Problem taking apps with Cmd - Tab

    I usually use Cmd - Tab to switch from one application to another and now I have a problem using this El Capitan. Yosemite and the previous operating system when I use this I expect to see the window which was open in the application I'm through. For

  • Empty text box value when reading about the LV2012 development system but no Production

    Development platform: 32-bit Windows 7, LV2012 Professional Development System. Production of platforms: Windows XP. We have a test application, we have developed (in haste, I might add) who has a curious problem.  As part of the installation for eac

  • Difficulty of vista of buffer overflow

    I need a simple way of difficulty bluestack unable to start error vista and also buffer overflow error

  • Smartphones to blackBerry Curve 8900, vibrations ring

    Hello I'm using curve 8900 and I don't know what is wrong with it but I tried to put the profiles NORMAL to leave only the phone rings with tone and with no vibration but it still vibrates whenever the phone rings. Is it possible, this could be corre

  • Migrated Win 7 on MBP can not activate

    I recently purchased a new Mac Book Pro and installed Windows 7 Home Professional software of machine virtual Parallels. I had bought a three license Win 7 then update back and only two of the licenses used so I guess that the third if necessary coul