To get the last 12 months from the input date

Hi ,
Is there any way in sql  to get the last 12 months date if i input the sysdate.
LIke I will input sysdate (16-aug-13 ) and I need to get 16-jul-13,16-jun-13,16-may-13 like this.
This has to be done in the sql only with out using pl/sql
Regards,
Papi

select listagg(to_char(dt,'dd-mon-yy'),', ')
          within group (order by dt desc) dates
from   (select add_months(date '2013-08-16',level*-1) dt
         from dual connect by level <=12
DATES
16-jul-13, 16-jun-13, 16-may-13, 16-apr-13, 16-mar-13, 16-feb-13, 16-jan-13, 16-dec-12, 16-nov-12, 16-oct-12, 16-sep-12, 16-aug-12

Similar Messages

  • Why I can only download 20 photos for last month from the photostream while I have more than 3GB photos kept in iCloud? Many thanks.

    Why I can only download 20 photos for last month from the photostream while I have more than 3GB photos kept in iCloud? My iPhone was stolen and the photos in it are very precious to me. Many thanks.

    On a new device you can only download what is currently stored in "My Photo Stream" in iCloud. iCloud keeps up to the last 1000 photos, but only the photos, that have been added during the last month. Older photos may be removed, when the time is up. On other devices you may be seeing older photos as well in "My Photo Stream", that will depend on the available storage on those devices, and when the Photo Stream has been enabled on those devices, see:  My Photo Stream FAQ - Apple Support
    If you are seeing other photos in the Photo Stream on other devices, that you want to save, mail them to you from the other devices.
    Have you tried to restore your iPhone from the last iCloud backup of the old phone? The backup will contain the photos in the Camera Roll, but not the photos in Photo Stream.   iOS: Back up and restore your iOS device with iCloud or iTunes

  • How to get the sales value of the last month in the quarter

    Hi,
    We have a requirement to get the "Sales" value against a quarter. We have 2 tables "Time" and "Sales". We want to display the Sales value against each quarter.
    But this should happen as follows.
    Consider quarter Q1 it should display the value of 3rd month, Q2 should display value for 6th month and so on..
    If in any particular Quarter we dont have a value for last month then it should display the value for 2nd month, if 2nd month value is also not present then it should display 1st month sales value.
    We are using excel as the database.
    Please let us know if anybody has a resolution to this.
    Regards,
    Apoorv Chitre

    hi,make an other column which will be the flag for the last months you want to be displayed...
    so ,in reports,you pass it as hidden column(by filter only the ones which have the appropriate flag),and then voila...
    i hope i helped
    http://greekoraclebi.blogspot.com/
    ///////////////////////////////////////

  • Get the last query from the current user

    Is there a way to get the last query of the current user, so every query could be log with a database trigger?
    Let's just say I execute:
    DELETE xxxx;
    I tried :
    SELECT T.SQL_TEXT FROM V$SQLAREA T where ADDRESS=(SELECT prev_sql_addr FROM v$session where audsid=userenv('sessionid'));
    But the result of this query is :
    'SELECT T.SQL_TEXT FROM V$SQLAREA T where ADDRESS=(SELECT prev_sql_addr FROM v$session where audsid=userenv('sessionid'))'
    Is there a way to execute a query that would return :
    'DELETE xxxx'
    Thanks

    You could join SQL_ADDR in v$session with ADDRESS in v$sqlarea to determine the SID that executed that SQL statement last. Note that PREV_SQL_ADDR in v$session will indicate the previous SQL he executed. Though you would have to look at these tables very often to get all SQL statements issued. One note here, I think if a different user ran the SAME SQL with just bind var differences the SQL_AREA will only show the last user’s information that executed it.
    BTW - it will show deletes also...

  • Unpivot taking the last letter from the column name

    Hi guys, having
    DATE               Period1 Period2 Period3 Period4
    01/01/2014       1.02       1.06      1.02      1.03
    02/01/2014       1.06       1.05      1.04      1.06
    I would like an unptivot as
    01/01/2014    1        1.02
    01/01/2014    2        1.06
    01/01/2014    3        1.02
    01/01/2014    4        1.03
    02/01/2014    1        1.06
    02/01/2014    2        1.05
    02/01/2014    3        1.04
    02/01/2014    4        1.06
    But I'm wondering how can I take the last letter of the column. Maybe I should use a select case...
    Any advices? Thank you   

    DECLARE @Table TABLE
    dt DATE,
    P1 INT NULL,
    P2 INT NULL,
    P3 INT NULL,
    P4 INt NULL
    INSERT INTO @Table(dt, P1, P2, P3, P4)
    VALUES('20140101',10,null,20,3);
    INSERT INTO @Table(dt, P1, P2, P3, P4)
    VALUES('20140102',50,25,15,5);
    SELECT dt, row_number() over (partition by dt order by dt) rn,per AS DayMax FROM @Table
    UNPIVOT (per FOR DayNumber IN (P1, P2, P3, P4)) AS c
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to get the last record from the database

    I am using MS Access database and Swings as GUI. I want to get the last record of a particular column from the table and store it as a varaible.

    Hi
    To get Last record of resultset, you have pass some parameter in constructor of CreateStatement.In such case Resultset should be scrollable and Readonly
    Example
    objStatement=objCon.createStatement ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    mwwResultSet=cwwStatement.executeQuery(mwwSqlQuery);
    while(mwwResultSet.next())
    if(mwwResultSet.isLast())
    //Fetch the required column record.
    String abc=mwwResultSet.getString(1);
    I think this will work. Try it.
    bye

  • Getting the last record from the internal table

    When we use a READ statement it always picks up the first record which fulfill its condition but in my case I want to pick up the last record that fulfills it condition
    I have a internal table like
    id     type
    N1      A
    N1      T
    N1      A
    N1      6 ----> LAST RECORD
    my code is
    read table itab wIth key id = netobjid.
    for eg if netobjid = N1 , then I want to read the last record that corresponds to N1 ie ID N1 TYPE - 6...
    How to do that?

    HI
    actually i have done same requirement like this ...
    Take  one count variable into your internal table ..you pass the number of records into cont variable for every time  u enter the loop .
    Sort the internal table with count variable descending . ( AS we cant sort the internal table with sy-tabix)
    Then use read statement with sy-index = 1 .
    USe below logic ,............
    data  :  count  type i value '0'.
    LOOP at int .
    count = count + 1 .
    endloop.
    sort int count descending .
    read int  with  index = 1 .

  • Hi my late 2008 model Mac Book Pro has gotten really slow and has made a loud noise twice in the last month.

    My Macbook is not acting right it has gotten very sluggish online and has made a really loud buzz or screaching sound twice  in the last month.  The first time I was just on the internet and it wouldn't quit making the loud noise until I turned it off and back on.  This last time it made it while restarting it or was in the process of restarting from updating and while it was still a black screen it made that noise but stoped on its own this time.  I have no idea what to check in Macs or where to looks for errors or problems.  If someone could please direct me in what I can check to see if there is any info on what may be problemactic on my computer.  Thank you. Laurie

    Thank you ds store for replying.  Not to sound ignorant but I am when it comes time to this...how do I upgrade to 10.6?  I also think I have all the ram installed I can on it.  This is what system profiler shows in memory.
    Memory Slots:
      ECC:          Disabled
    BANK 0/DIMM0:
      Size:          2 GB
      Type:          DDR3
      Speed:          1067 MHz
      Status:          OK
      Manufacturer:          0x80CE
      Part Number:          0x4D34373142353637334448312D4346382020
      Serial Number:          0x83B0A0D8
    BANK 0/DIMM1:
      Size:          2 GB
      Type:          DDR3
      Speed:          1067 MHz
      Status:          OK
      Manufacturer:          0x80CE
      Part Number:          0x4D34373142353637334448312D4346382020
      Serial Number:          0x83B0A0E0
    Also the link you profided is this what the update to 10.6 will provide?  I really didn't understand the tech language so I didn't understand what it was telling me.  I am sorry to be so inept on this.  I just had to have the battery replaced about a month ago and while in the store I was asking the tech to check all the error messages and make sure everything was OK because I had no clue what they meant or if I had any problems.  I just use it I guess you would say.  The tech said I didn't need to worry about any of that stuff that Mac's don't get viruses and I was fine.  Well that didn't answer checking for hardware problems or anything like that but he didn't have anything else to say about it.

  • The events of the last month have suddenly disappeared.  I have opened these successfully several times during the last few weeks, but on opening them yesterday they weren't there any longer. No idea how this could have happened! Possible to retrieve ???v

    The events of the last month, with the photographs have suddenly disappeared from the iPhoto Library.  I have opened these successfully several times during the last few weeks, but on opening them yesterday they weren't there any longer. No idea how this could have happened! Is it possible to retrieve ???

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • Selecting the last record from a database table

    In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key.  In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first.  I know I can use an internal table to sort the records first and then retrieve the right value.   But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step?  Thanks!

    hi,
    tables:mara.
        data: begin of it_mara occurs 0,
                matnr like mara-matnr,
                meins like mara-meins,
                mtart like mara-mtart,
                end of it_mara.
    select-options:s_matnr for mara-matnr.
    select matnr
              meins
              mtart
    from mara
    into table it_mara
    where matnr in s_matnr.
    if not it_mara[] is initial.
    sort it_mara by matnr descending.
    read table it_mara index 1.
    endif.
    then you get the last record of the select statement.
    reward points if useful,
    venkat.

  • Why does safari 5.1 open with the last page from previous session?

    I don't want Safari 5.1 to open with the last page from the previous session.  How do I stop it?

    I too would like to manually or automatically open the windows and tabs I had open from the previous session, but I want to configure this per application.  In a browser for instance, I can have many windows and tabs open and it can take a lot of time to refresh them all. I would like to manually pick the windows/tabs I want to reopen. Before Lion I could restore the last session manually and I liked that ability. Firefox has a plugin for this And what if I reboot with no internet access, they all time out. With a word processor, spreadsheet, or xcode on the other hand, I like to start where I left off. Everything comes from local disk so the restart is fast. I want to control this by app, not globally. Sometime Apple can really be blind to the real needs of users, and that is to configure their envoronment the way the user needs, not the way Apple envisions the need of users.
    So Apple, please give ME the opportunity to choose the apps that auto reload the last sesion and give me a manual way to reload the last session on all apps that qualify.
    -KR

  • My phone has been smashed I need to get records of all my iMessages and texts from the last month. How do I get these?

    My phone has been smashed I need to get records of all my iMessages and texts from the last month. How do I get these?

    Do you have a backup of your iPhone which contains these messages?
    If so, you can restore a new iPhone from that backup during setup.
    If not, the messages are gone.

  • How to get the last day of the previous month

    Hello Team,
    If  my input date is today , then i need to find out the last day of the previous month for the same.
    Can someone help me  to find out .. how can this be done.
    Regards,
    Ravi

    Hi,
    Try the below code.
         // get a calendar object
        GregorianCalendar calendar = new GregorianCalendar();
        // convert the year and month to integers
        int yearInt = Integer.parseInt(year);
        int monthInt = Integer.parseInt(month);
         int dayInt = Integer.parseInt(day);
        // adjust the month for a zero based index
        monthInt = monthInt - 1;
        // set the date of the calendar to the date provided
        calendar.set(yearInt, monthInt, dayInt);
        int day = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
        return Integer.toString(day);
    Regards
    Venkat

  • Lately I have been getting a rectangular screen titled Login Setting, with my Username and Password and asking me to Login.  This screen shows up on opening the computer and has never been seen before the last month or so.

    Lately I have been getting a rectangular screen titled Login Setting, with my Username and Password and asking me to Login.  This screen shows up on opening the computer and has never been seen before the last month or so.  It has one box titled Login Credentials with a username and password field and a second box titled Login Status at the bottom where it says "Profile not found" in red.   I've never seen this before and ignoring it does not effect any operations.   Is this legitimate or some kind of identity fishing?

    Hello,
    Have you done the recent Security updates?
    Is this from Sleep or on bootup?
    Timing is about right for the FlashBack attack.
    Disable Java in your Browser settings, not JavaScript.
    http://support.apple.com/kb/HT5241?viewlocale=en_US
    http://support.google.com/chrome/bin/answer.py?hl=en-GB&answer=142064
    http://support.mozilla.org/en-US/kb/How%20to%20turn%20off%20Java%20applets
    Flashback - Detect and remove the uprising Mac OS X Trojan...
    http://www.mac-and-i.net/2012/04/flashback-detect-and-remove-uprising.html
    In order to avoid detection, the installer will first look for the presence of some antivirus tools and other utilities that might be present on a power user's system, which according to F-Secure include the following:
    /Library/Little Snitch
    /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
    /Applications/VirusBarrier X6.app
    /Applications/iAntiVirus/iAntiVirus.app
    /Applications/avast!.app
    /Applications/ClamXav.app
    /Applications/HTTPScoop.app
    /Applications/Packet Peeper.app
    If these tools are found, then the malware deletes itself in an attempt to prevent detection by those who have the means and capability to do so. Many malware programs use this behavior, as was seen in others such as the Tsunami malware bot.
    http://reviews.cnet.com/8301-13727_7-57410096-263/how-to-remove-the-flashback-ma lware-from-os-x/
    http://x704.net/bbs/viewtopic.php?f=8&t=5844&p=70660#p70660
    The most current flashback removal instructions are F-Secure's Trojan-Downloader:OSX/Flashback.K.
    https://www.securelist.com/en/blog/208193454/Flashfake_Removal_Tool_and_online_c hecking_site
    More bad news...
    https://www.securelist.com/en/blog/208193467/SabPub_Mac_OS_X_Backdoor_Java_Explo its_Targeted_Attacks_and_Possible_APT_link

  • Trying to rent movie from Apple TV. Message states a valid address is necessary to purchase. We have purchased about 15 show in the last month along. Any suggestion on how to update valid email address

    trying to rent movie from Apple TV. Message states a valid address is necessary to purchase. We have purchased about 15 show in the last month along. Any suggestion on how to update valid email address.

    I got the same error and can't get it to work.  My email and home address have not changed in the 3 years I've been using this device, my credit card info is up to date and my most recent rental was 2 days ago yet I get the error message on both the Apple TV and in iTunes.  I don't understand what the issue is, nothing is invalid.

  • All my iCloud photos are downloading to one of my computers, but only the last month's worth to another.  How can I get them all to download to both computers?

    All my iCloud photos are downloading to one of my computers, but only the last month's worth to another.  How can I get them all to download to both computers?

    When you on photo stream you will only get photos from the last 30 days (plus future photos added to your stream).  That's because they only remain in iCloud for 30 days.
    To get the old photos on your computer, import them using your usb cable, as explained here: iOS: Import personal photos and videos from iOS devices to your computer.

Maybe you are looking for

  • Several question s about runtime Engine, application builder and labview player

    I am a little confused by all the options to distribute a program. Please help bij answering (one of) the following questions: 1. Does an application built with the application builder always need the LV runtime engine? The LV runtime engine is 33 Mb

  • Safari anomalies with Macbook Pro Retina

    I've been using a MBPr for 2-3 months now, and have had three replacements with the same exact issues in Safari: Blocks of data show up as missing / corrupt on many websites (Gmail, Amazon, eBay, etc) Typing text into text fields shows delays / missi

  • Refresh Flex View

    Is there a key command or quick method of refreshing an entire tracks regions whilst it is in flex mode? For example; Say I have an audio track with some regions in it, I open flex view and select one of the algorithms to suit. Job done and all of th

  • Enterprise CC Acrobat XI won't install. It looks like a good install, but no sign of it!

    I have put numerous packages on a suite of various up to date Macs, all of which have installed successfully. Lastly, I try to put on Acrobat Pro and although it says Successful installation, there is no sign of it anywhere. When I do a search, the o

  • Exchange 2010 MP : Some Client Access test cmdlets failed to run

    Hi all, This error is triggered in SCOM 2012 R2 about a single Exchange 2010 SP3 server : Exchange 2010 MP : Some Client Access test cmdlets failed to run. When I dig into the error context, I can see it's about the cmdlet "Test-CalendarConnectivity