Select the query to select the month range based on the current date.

It's the database 10 g oracel.

I want to choose two months of data in the table. But these two months should be based on the current date.

For example.

If I run the select query on July 7, 2013, then the query must ignore the current month being July 2013 and last month, which is June 2013 and it shoud select only may 2013 and April 2013.

Can someone help me how to make this request.

SELECT *.

FROM my_table

WHERE my_date > = TRUNC (ADD_MONTHS (sysdate,-3), 'MY') - first day of the month 3 months ago

AND my_date< trunc(add_months(sysdate,-1),'mon')="" --="" first="" day="" of="" last="">

Tags: Database

Similar Questions

  • DateFields 5.0 + operating systems. Impossible to select the current date.

    Have a slight situation.    Have a date with the value field by default of - etc.   The user is not able to select the current date, and must choose another date and what to do again to select the current date.

    This works very well in the pre - 5.0 OSes, but does not work with 5.0 +.

    The date field popup works fine, but if the user tries to select the current date, it is not get populated in the date field.

    I see what you mean now.  I connected it the Issue Tracker here: https://www.blackberry.com/jira/browse/JAVAAPI-1163

  • DateField, can not be able to select the current date

    Hai,

    I use DateField in my application. Initially, the date field is showing-/-/---(JJ/MM/AAAA) this format. So if I click on this field to date I can't able to select the current date. If I go on any later date or past date and define it and that I can not choose the current date.

    Hai,
    Thax for your quick response...
    I found this question in "Issue Tracker" here: https://www.blackberry.com/jira/browse/JAVAAPI-1163

  • How to get the old data 6 months from the current date?

    Hi friends,

    I have a table which includes historical data, which are having more than 1 years old data. The historical table gets updated once a week. My requirement is that I should get the latest data from the week of each month for 6 months according to the current data. I use oracle 10g.

    Can you please someone help in this.

    Thanks in advance

    SELECT last_day (ADD_MONTHS (TRUNC (SYSDATE, 'mm'),-LEVEL))-7 start_dt.
    LAST_DAY (ADD_MONTHS (TRUNC (SYSDATE, 'mm'),-LEVEL)) end_dt
    OF THE DOUBLE
    CONNECT BY LEVEL<=>

    change as a result, I have provided you the start and end dates for your logic...

  • Display the current date in the area of the page

    Hello
    Is it possible to display the current date in the region of the Page?

    I need to do something like: welcome & APP_USER. < date >

    Please let me know!

    Hi Suzi,

    I think that the easiest thing would be to create an element of the Application called, say, CURRENT_DATE. Then create a demand for this article - it may be a SQL query:

    SELECT TO_CHAR(SYSDATE,'DD/MM/YYYY') FROM DUAL
    

    You can set it to run once per login or before header.

    Then, edit your page templates and add & CURRENT_DATE. (including the & and the.) wherever you want the date to appear

    Andy

  • get the current date for condition satisfied

    Hello world

    I want to get the current date for the following query.

    SELECT B.NAME, C.FST_NAME, C WHERE S_CONTACT, S_ORG_EXT B, C.LAST_NAME OF S_PARTY_PER A (B.ROW_ID = A.PARTY_ID AND C.ROW_ID = A.PERSON_ID AND A.PERSON_ID IN (select D.NEW_VAL from the S_AUDIT_ITEM where D.OPERATION_CD = 'Associate' and OPERATION_DT = 'I want the current date from 07/10/2008 12:00:00 AM to 07/10/2008 23:55:55 '))

    Help, please...

    Hello

    Like this?

    SELECT B.NAME, C.FST_NAME, C.LAST_NAME
      FROM S_PARTY_PER A, S_ORG_EXT B, S_CONTACT C
     WHERE (B.ROW_ID = A.PARTY_ID AND C.ROW_ID = A.PERSON_ID AND
           A.PERSON_ID IN
           (select D.NEW_VAL
               from S_AUDIT_ITEM D
              where D.OPERATION_CD = 'Associate'
                and trunc(OPERATION_DT) = trunc(sysdate)
    --                'i want current date start from 10/7/2008 12:00:00 AM to 10/7/2008 11:55:55 PM'))
    
  • BI Layout Editor - how to display the current date?

    Hello

    Recently used BI Layout Editor (previously using MS Word to create the presentation of the State).

    He seems really nice and easy to use.

    However quick Q - How to display the current date in the layout editor (to show the report run date).

    Any quick suggestions is appreciated.

    Thank you

    Vivek

    Tab displays your selection available.

    It's like how when you insert the table in the Word document and when you select the table, you would see 2 additional tabs such as the design and the tool.

    Can you please insert "Text Element" and select the text element and see if you go to the tab 'text '?

  • change the color of the current date af:inputDate

    Dear experts,

    I have demands to change the color of a specific date in af:inputDate, but I can't find a way to change the date of the day color (04/09/205-JJ/MM/AAAA). Do you have any suggestions?

    I want the 09/04/2015 also green.

    selectedDate.png

    Thank you

    Ricky

    Hello

    AF | chooseDate::today The styles of the appearance of the cell of the table for the current date (today). For example, you can add a background color or a border to the cell.

    Pseudo classes Description
    selected

    JSPX page

    Below the code in skin file works for me, when we choose a date

    AF | {chooseDate::today}

    background-color: black;

    }

    Thank you

    Amey

  • I need to create a table that has each increment of 15 minutes between the current date and time in the past.

    I can around the current datetime object to the the last quarter of an hour and show all dates for last year, but I'm looking for all the 15 minutes for each day of '1 October 13' to the current date.

    Here's what I have so far:

    SELECT

    trunc (sysdate, 'mi')-

    NUMTODSINTERVAL (mod (to_char (sysdate, 'mi'), 15), 'minute') as Quarter_Hr,

    (sysdate-365 (LEVEL-1)) AS DATES

    FROM DUAL connect by level < = (sysdate-(sysdate-365))

    Any help would be appreciated. I use that as a dimension table to evaluate performance on a base quarter of an hour.

    ALTER session set nls_date_format = "hh24:mi:ss dd/mm/yyyy '.

    /

    Select date "'2013-10-1 + (level - 1) / 96 dt"
    of the double
    connect by level<= trunc((sysdate="" -="" date="" '2013-10-1')="" *="" 96)="" +="">
    /

    DT
    -------------------
    01/10/2013 00:00:00
    01/10/2013 00:15:00
    01/10/2013 00:30:00
    01/10/2013 00:45:00
    01/10/2013-01:00
    01/10/2013-01:15
    01/10/2013-01:30
    01/10/2013-01:45
    01/10/2013-02:00
    01/10/2013-02:15
    01/10/2013-02:30

    DT
    -------------------
    01/10/2013-02:45
    01/10/2013-03:00
    01/10/2013-03:15
    01/10/2013-03:30
    01/10/2013 03:45
    01/10/2013 04:00
    01/10/2013-04:15
    01/10/2013-04:30
    01/10/2013-04:45
    01/10/2013-05:00
    01/10/2013-05:15

    .

    .

    .

    DT
    -------------------
    06/08/2014-11:45
    06/08/2014-12:00
    06/08/2014-12:15
    06/08/2014-12:30
    06/08/2014-12:45

    29716 selected lines.

    SQL >

    SY.

  • How do I add 7 days to a date and compare it to the current date in a cfquery?

    I have classes that are no longer active once after the date of the class. However, the class should be displayed for seven days more in the backend. I tried to use the script below to get there, but I get an error "Variable DATE is not defined." I'm going in the right direction or is there a better way to do this?

    < name cfquery = "getClasses" datasource = "#application.dsn #" >

    Select *.

    (break the classReg INNER JOIN classReg.classID = classes.classID) INNER JOIN instructors ON classreg.instID = instructors.instID

    <!-adding seven days to the date of the class (date) by comparing the current date->

    where #DateFormat (DateAdd (would be ', 7, date), 'yyyy-mm-dd') # > #DateFormat (now (), 'yyyy-mm-dd') #.

    < / cfquery >

    where #DateFormat (DateAdd (would be ', 7, date), 'yyyy-mm-dd') # > #DateFormat (now (), 'yyyy-mm-dd') #.

    As Coldfusion said you, quite rightly so, he knows no variable called "date". You're in a request and, apparently, 'date' is a column name. So use the SQL functions instead of Coldfusion functions.

    In MySQL, the appropriate where clause is:

    WHERE DATE_ADD (date, INTERVAL of 7 DAYS) > CURDATE)

    In SQL Server, the appropriate where clause is:

    WHERE DATEADD(day,7,date) > GETDATE()

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

    Afterthought: I would rename the column 'date', as it is a reserved word in some database management systems

  • quickly create with filter-date and initialize it with the current date

    Oracle BI 11 g

    Hello!

    I need to create guest of dashboard with filter-date and initialize it with the current date. How can I do?

    I tried to create the repository initialization block and add a variable. But I don't know what should I write to DataSource? I tried using the Current_Date, Now(), sysdate functions (for example, SELECT Now() FROM tbl_Calendar) but without results - when I pressed the button "Test"... "I have errors - something like 'Now() is unknown function' or 'incorrect syntax near keyword Current_Date.

    After that, I made to use presentation Variable in the command prompt, but also without success (())

    Please, help me.

    Use "Server Variable.

  • Can I do a box fill in the current date?

    I was invited to make a form that has quite a few boxes.  These boxes must also be marked with a date when checked.

    Rather than having the person filling out the form, type the date each time that they check the box, they ask that when the user clicks on the checkbox indicating a current date next to the check box.

    I don't know if this is possible with a date stamp of the day or to have a text box that fills with the current date, etc.

    The forms will also be used for several days, so I can't call him on a "date" and show/hide text box I had initially thought to do.

    I'm also really green at scripts so that any help or advice in the right direction would be much appreciated.

    Thank you.

    The following script the mouse upward to a checkbox will define the text field associated with the current data when selected and empty the field is not:

    // Mouse Up script for check box
    (function () {
    
        // Get a reference to the text field
        var f = getField("text1");
    
        // Set the value of the text field
        if (event.target.value !== "Off") {
            f.value = util.printd("mm/dd/yyyy", new Date());
        } else {
            f.value = "";
        }
    
    })();
    

    Replace "text1" with the name of the associated text field.

  • Display the current Date on the topic title (TTITLE)

    I'm using sql * more to write a report. For the current date (and time if possible), I would like to be displayed in the title of my report (TTITLE.) It seems that I'm supposed to use a system variable called _DATE, but I don't know what to do.  I am under sql * more v.10.2.

    Here is my code. How can I include the current date to display in the side 'RIGHT' in the topic TTITLE?
    TTITLE ON
    TTITLE LEFT 'MY COMPANY' CENTER 'Weekly Invoice Totals for Cost Center: 10 - MANAGEMENT' RIGHT 'Date: ' 
    
    set pagesize 66
    set linesize 120
    set wrap off
    
    column vendor_name heading 'Supplier' format a40
    column invoice_num heading 'Invoice Number' format a30
    column invoice_amount heading 'Invoice Amount' format 999,999,999.99
    
    set underline =
    compute sum label TOTAL of invoice_amount on vendor_name
    break on vendor_name skip 2
    
    SELECT 
    po_v.vendor_name,
    ap_inv.invoice_num,
    ap_inv.invoice_amount,
    FROM
    ap.ap_invoices_all ap_inv,
    po.po_vendors po_v,
    WHERE
    ap_inv.vendor_id = po_v.vendor_id and
    ap_inv.creation_date > SYSDATE-10;

    Well, to date, you could use predefined SQL * more variable _DATE of substitution:

    SQL> TTITLE LEFT 'MY COMPANY' CENTER 'Weekly Invoice Totals for Cost Center: 10 - MANAGEMENT' RIGHT 'Date: &_DATE'
    SQL> SELECT 1 FROM DUAL
      2  /
    
    MY COMPANY                             Weekly Invoice Totals for Cost Center: 10 - MANAGEMENT                        Date: 22-JAN-10
             1
    ----------
             1
    
    SQL> 
    

    Unfortunately, it has not predefined SQL * more variable substitution for the moment. You will need to use a suggestion that Frank (or if you want the date in a different format).

    SY.

  • Does not receive the current date in InputDate Field when MinValue setting...

    I drag and drop a field entry Date in page jspx... To define the MinValue as the current date, I bind the MinValue to a variable declared to the backingbean... When I want to select the current date, * current date is diasbled... * But the message is displayed as "* enter a date on or after 06/29/2009 *"... * how to select current date * (29/06/2009)...

    Jspx page code
    ===========

    * < af:inputDate label = 'Release Date' id = 'ipdtDate. "
    * Binding = "#{backing_RelPlan.ipdtDate}" *.
    * MinValue = "#{backing_RelPlan.Today}" / > *.

    + backing bean contains +.
    =======
    * Date now = new Date(); *

    * public Sub setToday (Date today) {*}
    * This.Today = today; *
    *}*

    * public Date getToday() {*}
    * return today; *
    *}*

    Hi Briston,

    somehow, you must set the time to midnight or cut. It works for me:

    package brano.test1.view;
    
    import java.text.SimpleDateFormat;
    
    import java.util.Date;
    
    public class MyBB {
        private Date today;
    
        public MyBB() {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            try {
                String stringToday = sdf.format(new Date());
                today = sdf.parse(stringToday);
                System.out.println(stringToday);
            } catch (Exception e) {
            }
        }
    
        public void setToday(Date today) {
        this.today = today;
        }
    
        public Date getToday() {
        return today;
        }
    
    }
    

    Kind regards

    Branislav

  • analysis of filter based on the current date to the exercise YYYYMM

    In a filter for an analysis, I want to put in place so that the settings are based on the current date and format field I want to filter is based on a July - June fiscal fiscal month.  (IE. Today, 22/04/2014 should feed the month of exercise with 201410 field)

    Is there a simple formula that can be set, based on the date of the day that will work like this?

    Use this

    Replace (Cast (Year (CURRENT_DATE) as char) |) (case when month (current_date))<10 then="" '0'||cast(month(current_date)="" as="" char)="" else="" cast(month(current_date)="" as="" char)="" end),'="">

    Instead of these functions concat and casting If you use exercise and exercise name is good to go

    Thank you

    http://cool-bi.com

Maybe you are looking for