How to do a range of months

Hello

I need to get a number of columns in the past 25 months. How to do this?

How to change this:

Select count (column1)

table

where to_date (update, ' mon-yyyy "")

between to_date (sysdate-25, ' mon-yyyy "")

and to_date(sysdate,'mon-yyyy')

Thank you

There,


Hello

SYSDATE - 25 means 25 days ago.

ADD_MONTHS allows to find what date was 25 months ago:

SELECT COUNT (column1) AS column1_cnt

FROM table_x

WHERE BETWEEN ADD_MONTHS (SYSDATE,-25) update

AND SYSDATE

;

This assumes that this update is a DATE.

If it is currently 12:30 on 11 February 2014, then

ADD_MONTHS (SYSDATE,-25)

returns 12:30 January 11, 2012.  If you want to include the entire month of January 2012, then use TRUNC.

I hope that answers your question.

If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.

Explain, using specific examples, how you get these results from these data.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: https://forums.oracle.com/message/9362002

Tags: Database

Similar Questions

  • How to activate the range high voltage E364Xa power adapter

    I use E364Xa power supplier code example downloaded with the driver E364Xa the Web site of NOR. I need the output in the range of high voltage voltage. Please see attachment tha. But the example code has been an error when the output voltage is greater than the range of low voltage. The default setting for the equipment is low voltage range. Does anyone know how to activate the range high voltage before you configure the output voltage?

    Problem solved. I found the order of output range VI.

  • The date system in the taskbar indicates the year, month, day (as in the army). How can I read the day, month, year?

    The date system in the taskbar indicates the year, month, day (as in the army). How can I read the day, month, year?

    It's weird, in my version (Windows 7 Pro), it shows much more than that.

  • Hi, I have a question, I m interested in buying cc for oligo, but I didn't how will look at payment collected monthly from my account. I m from Poland, is if there is any conversion related to the collection to the monthly fee? Exceeds one

    Hi, I have a question, I m interested in buying cc for oligo, but I didn't how will look at payment collected monthly from my account. I m from Poland, is if there is any conversion related to the collection to the monthly fee? Is beyond the $ 19.99 euros will be ordered to pay the money transfer from zlotys to the euro.

    Hello

    In order to know the payment process, you can contact Adobe support:

    https://helpx.Adobe.com/contact.html?step=CCSN

    To know the offers and different plans, you can visit the Adobe Web site:

    Pricing plans and creative Cloud membership | Adobe Creative Cloud

    Let us know if you need more information.

  • It costs more to go to monthly payments?  How to pass the year to monthly payments?

    It costs more to go to monthly payments?  How to pass the year to monthly payments?

    Diane H,

    Yes, the month subscriptions are expensive as they come without see all annual contract, Adobe - General conditions of subscription

    To change your plan see, update or change your plan creative cloud

    Let us know if that helps.

    Kind regards

    Bani

  • How can I cancel my subscription (month to month).  The instructions on the support pages does not work.

    How can I cancel my subscription (month to month).  The instructions on the support pages does not work.

    Contact customer support to Adobe from Monday to Friday during normal business hours.

    1 (800) 833-6687

    Contact customer support via Online Chat

    NOTE: A cancellation fee may apply.

    Nancy O.

  • How to get LASTDAY for each month between data dates...

    Hi friend

    I have a doubt, how to get LASTDAY for each month between data dates...

    for ex:
    My contribution will be like this
    date = 01/12/2011
    To date = 14/04/2011

    And I need an output like
    31/01/2011
    28/02/2011
    31/03/2011

    is it possible to achieve through sql query in oracle
    Thanks in advance for all friends to help him

    Hello

    Something like this (assuming that the dates are originally VARCHAR2s):

    SQL> var dt_start varchar2(10)
    SQL> var dt_end varchar2(10)
    SQL> exec :dt_start := '12-01-2011'
    
    PL/SQL procedure successfully completed
    
    SQL> exec :dt_end := '14-04-2011'
    
    PL/SQL procedure successfully completed
    
    SQL>
    SQL> select last_day(
      2           add_months(
      3             trunc(to_date(:dt_start,'DD-MM-YYYY'),'MM'),
      4             level-1
      5           )
      6         ) as result
      7  from dual
      8  connect by level <= months_between(to_date(:dt_end,'DD-MM-YYYY'), to_date(:dt_start,'DD-MM-YYYY'))
      9  ;
    
    RESULT
    -----------
    31/01/2011
    28/02/2011
    31/03/2011
     
    

    If the dates are already of the date data type, simply remove the to_date function.

  • How can I unsubscribe from a monthly automatic renewal for the Washington Post?

    I don't want to get the Washington Post more. It automatically renews each month and I pay on my Apple account. How can I stop it?

    There are instructions on this page to manage and automatic shutdown iTunes-renewal of subscriptions: view, change or cancel your subscription - Apple Support

  • How do I stop by hbo monthly subscription now

    How do I stop my HBO subscription monthly now?

    Assuming that you have subscribed to via iTunes...

    iOS

    Go to settings > iTunes and App Store > Apple ID > review Apple ID and enter your password when you are prompted, contributions of position press 'Manage' and use the available options to cancel a subscription.

    OSX

    Go to iTunes > account (menu bar) > view my account and enter your password when you are prompted, under the position settings, click on 'Manage' to the right list subscriptions and use the available options to cancel a subscription.

  • How to repeat an event every month, and that the event referred to the previous Friday if the event falls on a weekend.

    Company is paid twice a month. The 15th and the last day of the month.

    Defining the last day of the month would repeat each month, day of the last week. But how do you define the 15th with these conditions:

    If the 15th falls on the weekend, it will be Friday before the weekend. For example, May 15, 2016 falls on a Sunday, the event must be moved to May 13 instead. Is this possible?

    Thank you!

    Found the answer.

    Snow Leopard iCal - event on Friday if the Nth is a weekend/holiday?

  • Equium A100: How to increase WiFi range

    Hello

    I have an Equium A100 and wondering if I can increase the wi - fi range with any form of add the accessories?
    I have to balance my laptop on the windowsill of my apartment to pick up my more close to 'hot spot '.

    Any ideas?
    Thank you.
    Gus

    Hello

    You can increase the range of WLan and performance, but you will need a Wlan antenna.
    For example, like this [external Wireless USB Adapter | http://www.wirelessnetworkproducts.com/index.asp?PageAction=VIEWPROD&ProdID=1624]

    On [this page | http://www.wirelessnetworkproducts.com/index.asp?PageAction=Custom&ID=21] there are also a few tips and useful explanations on stronger WLan range:

    How about a litte film ;)
    Check the Youtube how to increase your Wi - Fi Signal. It s nice and sometimes incredible ;)
    http://www.YouTube.com/watch?v=LY8Wi7XRXCA

  • How to extend the range of my Airport Extreme Base Station (802. 11 a, c) using a relay of Airport Express (802.11n).  Airport Utility (V635.2) says that this version does not support the relay.  That is what it is?

    How can I extend the range of my Airport Extreme (802. 11 a, c) using an Airport Express (802.11n) point.  Airport (V635.2) utility does not recognize the Express on its screen?  I have to buy equipment?  I'm on a MacPro OS X 10.10.5.  Thank you.

    AirPort utility that ships with OS X 10.10.5 supports base stations as 802.11ac & 802.11n AirPort. It should be able to configure both of your base stations for a scope (wireless connected base stations) or roaming types (base station connected Ethernet) wireless networks.

    When you initially configure the Wan, it helps to keep the two base stations in the same room. Once configured, you can move the base station that extend to the desired location. The important key is that the final positioning of the station that extends the base must be understood that it's to expand in order to maintain sufficient bandwidth to the station remotely for clients from network connected. Please check the following airport user tip for more details.

  • How would open a range of ports?

    I play a video game on my computer that requires the use of several ports to open at the same time, but can not find all the information on how to do this when you use the Windows Firewall. I can open the ports one at a time, but it would take a week to watch this range. (Not really, but you know what I mean) So, I guess my question is, "How do I open a beach using the Vista firewall"?

    Hello Vercetian,

    Thanks for posting your question on the Microsoft answers Community Forum.

    After researching, I found another question on the same issue:
    It comes from the http://www.dslreports.com/forum/r19700203-Vista-Opening-Multiple-ports-in-Windows-Firewall
    This Cable Guy article reiterates that you can apply a list of ranges of ports, IE. format CSV (values) separated by commas. Again, try to create the list in Notepad, then copy - paste of the list for Windows Firewall.

    Exceptions can be configured for all or multiple ports

    When you configure an exception based on the ports with the current Windows Firewall, you can specify a single TCP or UDP port. With the new Windows Firewall, you can also specify all ports TCP or UDP (for all TCP or all UDP traffic) or a list separated by commas of several ports. To configure the new Windows Firewall for a range of ports, you must specify all the ports in the range. For example, if you want to configure an exception for the range of ports 1090-1095, you must configure the following ports: 1090,1091,1092,1093,1094,1095.

    Hope that answers your question.
    Please reply if this solves your problem or if you need further support.

    Sincerely,

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to calculate the range a delay?

    Hi all..

    Please help me.

    I have the same case.

    I have periods of field in table A, example "Jan-15'.

    and then in the table B, I have another example of period, "Feb-16'.

    I can calculate range "Jan-15' up to the" Feb-16'?

    Result: 14

    Thank you all...

    The query below will search the month,

    But you must supply exactly what input you train for a better solution.

    Select ceil (months_between (last_day (to_date (' FEB-2016 ',' MON-YYYY "")), trunc (to_date ("' JAN-2015 ',' MON-YYYY"))) double;)

  • How to calculate the percentage of monthly sales

    Hello

    I have a column sales of the month and I have another column that calculates (monthly sales / (total number of monthly sales)) * 100.

    How to calculate this percentage of sales.

    Please advice.

    Kind regards

    Séverine.

    You can use the AGGREGATE function for the TOTAL monthly sales in the year:

    Something like: AGGREGATE ("measure monthly sales" to "Time" ".") Time hierarchy ".» An »)

    Calculate your final formula:

    "measure the monthly sales" / AGGREGATE ("measure monthly sale 'to"time'." Time hierarchy ".» Year') * 100

Maybe you are looking for