get the last 6 months data

can I have a query that needs to retrieve only the most recent 6 months of sysdate.

output must
month
10/05/2011
10/04/2011
10/03/2011

etc.

Try this please

SELECT TO_CHAR(ADD_MONTHS(SYSDATE,1-LEVEL),'MM/DD/YYYY')
FROM DUAL
  CONNECT BY LEVEL <=6;

Tags: Database

Similar Questions

  • get the last ten weeks date value

    Hi friends,
    I have a requirement in which I need to get a list of 10 dates starting today on the same week. something similar to below but a list of all the 10 dates on the same day of the week

    Select sysdate-7 double

    output:
    2011-08-08
    2011-08-01
    2011-07-25
    2011-07-18
    2011 08-11
    2011-07-04

    and so on...

    Note: All of the above dates fall on Monday. I think I can do it using connect by clause, but need the exact syntax. I tried my best to get the result

    Please let me know.

    Ok.

    select sysdate -7*(level - 1) as dt from dual connect by level <= 11
    

    Not tested, not connected to oracle.

  • How to get the last date of 3 days for the current month?

    Hello. Guy

    How to get the last date of 3 days for the current month?

    MY OUTPUT WOULD LOOK LIKE THIS

    JANUARY 29, 2016

    JANUARY 30, 2016

    JANUARY 31, 2016


    GUYS HELP ME / / /...

    SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">

    LAST_DAY)

    ---------

    29 JANUARY 16

    30 JANUARY 16

    31 JANUARY 16

  • How to get the last business day of the previous month?

    Hi all

    We need the user as below,

    If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks

    Note:

    use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?

    TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))

    Thank you

    Deva

    Try this,

    case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end

    As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.

    Thank you

    AJ

  • For the last 12 months from the date of entry

    Hello

    Is it possible in sql to get the last date of 12 months if I input the sysdate.

    As I will be entered sysdate (August 16, 13) and I need to get 16-jul-13,16-jun-13,16-may-13 like that.

    This must be done in the sql only using pl/sql

    Kind regards

    PAPI

    one way:

    SELECT ADD_MONTHS (trunc (sysdate),-1 * ROWNUM)

    OF THE DOUBLE

    CONNECT BY ROWNUM<=>

    See you soon,.

    Manik.

  • I would like to get the list of all devices on which my creative cloud has been activated for the last six months or a year

    I would like to get the list of all devices on which my creative cloud has been activated for the last six months or a year

    I do not think that information... Adobe titles represent the only link I know following your accounts, but not where the programs are installed

    https://Accounts.adobe.com/ , then click on Plans & products above to find a list of your programs and your serial numbers

  • How to get the last day of the weekend rather than a month

    Hi all

    Is the request appropriate and preferable to use to get the last business day of the month below?

    SELECT to_date('13.08.2014','dd.mm.yyyy') + MAX(RNUM) LastDay(nonweekend)
       FROM   (SELECT ROWNUM RNUM
              FROM   ALL_OBJECTS where rownum <=31)
      WHERE   ROWNUM <= 31 ANd
         TO_CHAR(to_date('13.08.2014','dd.mm.yyyy') + RNUM, 'DY','NLS_DATE_LANGUAGE=ENGLISH' ) NOT IN ('SAT' , 'SUN')
         and to_date('13.08.2014','dd.mm.yyyy') + RNUM <= last_day(to_date('13.08.2014','dd.mm.yyyy'))
    

    I have to use this motion for production.

    East - recommended to use?

    You can change your query this way:

    WITH t AS (SELECT trunc (to_date ('& calc_date', 'dd.mm.yyyy'), 'mm') + level - 1 calc_date)

    OF THE DOUBLE

    CONNECT BY LEVEL<= last_day(to_date('&calc_date',="" 'dd.mm.yyyy'))="" -="" trunc(to_date('&calc_date',="" 'dd.mm.yyyy'),="" 'mm')="" +="">

    )

    Select max (calc_date)

    t

    where to_char (calc_date, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') NOT IN ("SAT", "Sun");

  • How to get the last day of a month for every 2 months for a given period?

    Hello

    Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?

    Thanks in advance.

    Try the below

    SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.

    SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1

    WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    END as lastweekday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    -(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).

    END as lastweekendday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7

    END AS lastmonday

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • I get a message saying "drive does not have the ability to access this service and I just paid for 12 months (FOR THE SECOND TIME) in the last two months!

    I get a message saying "drive does not have the ability to access this service and I just paid for 12 months (FOR THE SECOND TIME) in the last two months!

    Hi phillipt84805120,

    Make sure that you have the latest Adobe Acrobat Reader DC (Adobe Acrobat Reader DC install for all versions) installed on your computer to use the services of export to PDF as the older version of Reader support any more.

    Alternatively, you can use services online at https://cloud.acrobat.com/exportpdf

    Let me know if you are still having a problem.

    Kind regards

    Nicos

  • Get the last disc based on the date

    Version of database

    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE Production 9.2.0.8.0
    AMT for HP - UX: 9.2.0.8.0 - Production Version
    NLSRTL Version 9.2.0.8.0 - Production

    data and model table


    CREATE TABLE EXAMPLE
    (
    UNIT_ID1 VARCHAR2 (15 BYTE) NOT NULL,
    COLL_DATE1 DAY,
    ATTRIB_CODE1 VARCHAR2 (4 BYTE) NOT NULL,
    UNIT_ID2 VARCHAR2 (15 BYTE),
    COLL_DATE2 DAY,
    ATTRIB_CODE2 VARCHAR2 (4 BYTE),
    DATE OF AUDIT_INSERT_DATS NOT NULL
    )





    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008646', TO_DATE (OCTOBER 8, 2012 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'DP', 'W039712008646', TO_DATE (OCTOBER 8, 2012 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'),)
    'PP', TO_DATE (OCTOBER 9, 2012 11:10:56 "," MM/DD/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008646', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'DP', NULL, NULL,)
    'DP', TO_DATE (OCTOBER 9, 2012 11:11:02 "," MM/DD/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008647', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'DP', NULL, NULL,)
    'DP', TO_DATE (OCTOBER 9, 2012 11:15:18 ',' DD/MM/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008649', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'TP', NULL, NULL,)
    'TP', TO_DATE (OCTOBER 9, 2012 11:15:39 ',' DD/MM/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008650', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'RD', NULL, NULL,)
    'RD', TO_DATE (OCTOBER 9, 2012 11:16:10 ',' DD/MM/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008653', TO_DATE (OCTOBER 8, 2012 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'CX', NULL, NULL,)
    'CX', TO_DATE (OCTOBER 9, 2012 11:17:23 ',' DD/MM/YYYY HH24:MI:SS'));)
    COMMIT;

    -----------------------

    unit_id W039712008646 has two records. I need a query to get the last disk based on audit_insert_dats. Any help is appreciated.
    I tried to use max (audit_insert_dats) but not able to get a record

    user_anumoses wrote:
    unit_id W039712008646 has two records. I need a query to get the last disk based on audit_insert_dats.

    You can use the ROW_NUMBER() analytic function

    SQL> select *
      2  from
      3   (select a.*,
      4     row_number() over(partition by UNIT_ID1 order by AUDIT_INSERT_DATS desc) rn
      5    from sample a)
      6  where rn = 1;
    
    UNIT_ID1        COLL_DATE ATTR UNIT_ID2        COLL_DATE ATTR AUDIT_INS         RN
    --------------- --------- ---- --------------- --------- ---- --------- ----------
    W039712008646   08-OCT-12 DP                             DP   09-OCT-12          1
    W039712008647   08-OCT-12 DP                             DP   09-OCT-12          1
    W039712008649   08-OCT-12 TP                             TP   09-OCT-12          1
    W039712008650   08-OCT-12 RD                             RD   09-OCT-12          1
    W039712008653   08-OCT-12 CX                             CX   09-OCT-12          1
    
  • is there an easy way to get the number of months in a year in a date range?

    Hi, experts, I am a newbie.

    are there any easy ways to get the number of months in a year in a date range?

    I would like to write a user-defined function.

    the input parameters are startdate, enddate, year

    the output is a number, not a month.

    for example, case 1

    StartDate = 01032009 (DDMMYYYY)
    end date = 28022010 (DDMMYYYY)
    If the year 2009, the output is 10
    If the year = 2010, the output is 2

    case 2:

    StartDate = 10032009 (DDMMYYYY)
    end date = 15032010 (DDMMYYYY)
    If the year 2009, the output is 10
    If the year = 2010, the output is 3

    Thank you very much!

    Hello

    You can (also) try this:

    SQL> with s as (
      2  ------------ Sample data -------------
      3  select to_date('01032009','ddmmyyyy') startdt, to_date('28022010','ddmmyyyy') enddt, 2009 yr from dual
      4  union all
      5  select to_date('01032009','ddmmyyyy') startdt, to_date('28022010','ddmmyyyy') enddt, 2010 yr from dual
      6  union all
      7  select to_date('10032009','ddmmyyyy') startdt, to_date('15032010','ddmmyyyy') enddt, 2009 yr from dual
      8  union all
      9  select to_date('10032009','ddmmyyyy') startdt, to_date('15032010','ddmmyyyy') enddt, 2010 yr from dual
     10  ------------ Sample data -------------
     11  )
     12  select startdt, enddt, yr,
     13  months_between(
     14          least(trunc(to_date(yr+1,'yyyy'),'year') , add_months(trunc(enddt,'month'),1))
     15          , greatest(trunc(to_date(yr,'yyyy'),'year') , trunc(startdt,'month'))
     16  ) nbmonths
     17  from s;
    
    STARTDT    ENDDT              YR   NBMONTHS
    ---------- ---------- ---------- ----------
    01/03/2009 28/02/2010       2009         10
    01/03/2009 28/02/2010       2010          2
    10/03/2009 15/03/2010       2009         10
    10/03/2009 15/03/2010       2010          3
    

    It's pretty simple. (no connection with, without functions SQL only integrated multicast, etc...)

  • How to view the last 12 months of data in dashboards OBIEE 11 g?

    I need to create a report to show a metric for the last 12 months... How can I do that exactly?

    I know I should use the TimeStampAdd() function, but it does not somehow for... Please list me the details step by step if possible (filters, syntax, PivotTable).

    I'm basically pulling in a column of calendar month (e.g. YYYY / MM - 2014 / 01) and the quantity ordered (column of fact).

    Thank you

    Pat

    Hello

    Thanks for the reply... I think I got it however.

    Done via a pivot table... and he showed me the previous 12 months.

  • PowerCLI to find the host added in vcenter in the last 12 months

    Hello

    Can we use Powercli to find the host added in vcenter in the last 12 months

    Thank you

    The Get-VIEvent cmdlet and look for the HostAddedEvent.

    Get-VIEvent-beginning (Get-Date). AddYears(-1) - MaxSamples ([int]: MaxValue) |

    Where {$_-is [VMware.Vim.HostAddedEvent]}

    You can also use my Get-VIEventPlus function.

    Get-VIEventPlus-beginning (Get-Date). AddYears(-1) - EventType HostAddedEvent

  • Draw the last set of data (1000 samples) in a loop

    Hi, I read a waveform data continuously, but I would capture and draw the last data set after my stop. As shown in the picture of attacehd, when the condition is true I acquire data. The number of samples per read is 1000, and as you can see I used a shift register to store data. What I'd like to see where the loop stops is the last 1000 samples but when I acquire real-time data I get a random sample number when the loop stops. sometimes 90 samples, sometimes 950 samples etc... could you please let me know how can I get the last 1000 samples acquired in this loop

    I even used DAQmx buffer for data but I can not get the last 1000 samples

    Thank you

    If your task has a number of points to buy, I don't see how you could have a number UN predictable and random points in the buffer.  The task should stop after having acquired the points of "N" and then say it's done.

    What do you mean by "stop tripping?  You only have a 'start' trigger and it is not available for points once the task has been involved.  If you want the last 1000 points of the points "samples per channel", the last reading should return those.  I've never used the property "Done" before.  Count your samples read instead and stop once you have what you wanted.

  • Malicious software removal tool update problems the last few months. Suspended for a very long time. Vista Home Premium 32 bit SP2

    Hello

    The last 3 months when the download and installation of my updates for Windows Vista, it gets stuck for hours on the malicious software removal tool. I have to cancel it. Restart the computer and reinstall. Then he moved very well and quickly according to historical updates. Last month, it was really difficult to cancell it well. He finally got through it. Here is a little history on my machine. I'm very very well with this computer. Each week, I do disk Cleanup, then defrag with diskeeper, virus scan with Microsoft Security Essentials. And every six months, I run a very large disk check and I said to correct errors and try to fix bad sectors. More than 3 years, I only had 2 minor bluescreens. I always make sure I have all my products Microsoft put updated. When I first got this computer I had a guy I.T. (a neighbor) out of the box and clean all the useless garbage out of it and it partitioned the hard drive. More than 3 years, he managed as a champion. Always very fast and all.

    I hope that I'm not the only person having problems with this. Just start with the month of June, then July, then August.

    P.S. I have 2 laptops running XP sp3, one is 9 years old and the other is 11 years old, he had 2000 top PRO, but I just put XP sp3 on it last month. They run too much like fields. I take good care of my computers with a little help from my friend IT. They have the same programs as this one and I do the same things to them, but they do not have this same problem with the release of the MSRT tool. Which leads me to think that it is specific to Vista only, I have a Windows 7 computer yet, so I can't speak for seven.

    Any suggestions or ideas? We are scratching our heads on this one.

    Thank you in advance for your time and help

    Tim Kerr

    Your misguided use of registry cleaners could have caused this behavior! If you ever think that your registry database must be cleaned, repaired, amplified, to the point, cured, twisted, fixed or optimized (it isn't), read http://aumha.net/viewtopic.php?t=28099 and draw your own conclusions.

    See also http://blogs.technet.com/markrussinovich/archive/2005/10/02/registry-junk-a-windows-fact-of-life.aspx

    ~~~~~~~~~~~~~~~~~~~~~~~

    Your use of Revo Uninstaller and the foregoing notwithstanding, applications, (Norton and McAfee) are known to not uninstall (or upgraded) themselves.

    1. download the Norton Removal Tool, save it to your desktop: ftp://ftp.symantec.com/public/english_us_canada/removal_tools/Norton_Removal_Tool.exe

    2. close all open applications (that is, anything with an icon on the taskbar).

    3. click right on the file saved in #1 above, and then select run as administrator to run the utility. DO TAP not your keyboard until the race ends, then restart.

    4. open IE (only) to http://support.microsoft.com/kb/971058 & run it in DEFAULT and modes difficulty then AGGRESSIVE. [1]

    5. restart & test (i.e. the or shortly after seven 14-10 when the next MRT is scheduled to be released).

    ~~~~~~~~~~~~~~~~~~~~~~~~
    [1] full Disclosure: the difficulty operating in AGGRESSIVE mode will remove your update history but not the list of installed updates.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

Maybe you are looking for