How to get min date each month for six months?

Hi, I have data like this.

Process_date SEQ_No
------------- ---------
16 MARCH 13 733
9 MARCH 13 732
MARCH 2, 13 731
24 FEBRUARY 13 730
16 FEBRUARY 13 728
9 FEBRUARY 13 727
2 FEBRUARY 13 726
26 JANUARY 13 725
21 JANUARY 13 724
JANUARY 12, 13 723
5 JANUARY 13 722
29 DECEMBER 12 721
24 DECEMBER 12 720
15 DECEMBER 12 719
DECEMBER 8, 12 718
3 DECEMBER 12 717
22 NOVEMBER 12 716
NOVEMBER 17, 12 715
10 NOVEMBER 12 714
NOVEMBER 3, 12 713
29 OCTOBER 12 712
23 OCTOBER 12 711
13 OCTOBER 12 710
OCTOBER 5, 12 709
28 SEP-12 708
22 SEP-12 707
15 SEP-12 706
08 SEP-12 705
01 SEP-12 704



everymonth admin will refresh the data table and automatically this table above is updated with unique seq_no and process_date.

I need extarct min date of everymonth (first 6 months discount - excluding the months perceive) and also the seq_no associated to this month so using joins (using the seq_no - which is available in the main table) I can combine the actual data.

I need result like:

March 2, 13 731 (I don't need MAR such that it take no data for the current month)

so I need final result as below:

2 FEBRUARY 13 726
5 JANUARY 13 722
DECEMBER 8, 12 718
NOVEMBER 3, 12 713
OCTOBER 5, 12 709
01 SEP-12 704
select
 min(Process_date) Process_date
,min(SEQ_No) SEQ_No
-- assuming that se_no increases consecutive with the date, otherwise
-- min(seq_no) keep(dense_rank first order by process_date) seq_no
from your_table
where
process_date < trunc(sysdate,'MM')
-- if there is data older than 6 months in your table, which is unclear
-- from your description and the data
--and
--process_date >= add_months(trunc(sysdate,'MM'), -6)
group by trunc(process_date,'MM')
order by process_date desc

Published by: chris227 on 25.03.2013 03:00

Published by: chris227 on 25.03.2013 03:03

Tags: Database

Similar Questions

  • How to get the date of deployment for the RT code?

    I'm using LabVIEW 8.5 and MAX 4.4.1f0 and cFP-2110. I want back the date of the deployment. Is it possible to recover the date of deployment for the RT code?

    Thank you

    Martine

    Hi John,.

    You must be able to FTP into your PSC 2110 from a Windows Explorer window and check the date of 'Change' of the startup.rtexe/or-rt/startup folder.

    Aaron P

    National Instruments

    Technical sales engineer

    http://www.NI.com/support

  • How to get future data 3 months

    Hi all

    I have a requirement where I need to get future 3 months of data.

    example: this month is jan

    In the report, I need to get jan, Feb, March data months.

    Please let me know how to do this, thanks in advance.

    Thank you and best regards,

    SR

    Use the report filter using your column in months as below

    month > = month (CURRENT_DATE) and month<>

  • How to get the Date in month based on week of the month.

    Hi gurus,

    I have provided.

    Quarter (Q) = > 1 (Jan - Mar), 2 (April-June), 3 (July-September), 4 (October-December).

    Months (M) = > Jan = 1, Feb = 2, Mar = 3 in the 1st quarter.

    ARP = 1, may = 2, Jun = 3 in the 2nd quarter,

    Jul = 1, August = 2, Ms = 3 in Q3,

    Oct 1 Nov = = 2, Dec = 3 in the 4th quarter

    If I give Q = 3, M = 3, W = 1 day = Fri so I get 6-Sep-13

    Similarly, if I give Q = 2, M = 1, O = 3, day = game so I get 18 April 13.

    Could someone help me higher and higher.

    Concerning

    Sanjeev

    Believing that when you say you want to say that it is 1 - 5 in a month with the 1st day of the month as the beginning of the 1st week of the week. You can try this.

    SQL > t
    2 as
    (3)
    4. Select q 3, 3 m, 1 w, 'Ven' d
    5 double
    6 union
    7 all the
    8. Select q 2, 1 m, 3 w, d 'game '.
    9 double
    10)
    11. Select q, m, w, d, d_day
    12 years of)
    13 select y + (level - 1) d_day
    14, ceil (extract (day of cast (y + (level - 1) as timestamp)) / 7) week_7_day
    15                   , t.*
    16 of)
    17 select add_months (trunc (sysdate, 'year') (q * 3-3) +(m-1)) y
    18                             , t.*
    19 t
    20                     ) t
    21 connect
    22 by level<= last_day(y)="" -="" y="" +="">
    23 and prior y = y
    dbms_random.value (24 and prior) is not null
    25         )
    where the 26 w = week_7_day
    27 and substr (to_char (d_day 'day'), 1, 3) = lower (d);

    Q M W D D_DAY
    ---------- ---------- ---------- --- ---------
    2 1 3 Friday 18 April 13
    3 3 1 Fri 06-SEP-13

    SQL >

  • How to get the date of request for a date column

    I have a requirement where I need to filter the data between two guests to date. I have only a single column of date and the date in the guests should be chosen by the calendar.
    I saw may approaches to do this, and I have one where two columns of fictitious date must be declared in the repository and used to define the guests of the date.

    but by using other methods I couldn't schedule option in the command prompt.

    but y at - it another way to get the guests with calndar selection without set dummy columns in the repository

    Thank you

    Try adding a column of similar date first and then edit the formula in the column

  • How to get the date for the first Monday of each month

    Dear members,

    How to get the date for the first Monday of each month.

    I wrote the following code

    SELECT decode (to_char (trunc (sysdate + 30, 'MM'), 'DAY'), 'MONDAY', trunc (sysdate + 30, 'MM'), NEXT_DAY (trunc (sysdate + 30, 'MM'), "LUN")) FROM DUAL

    But he looks at complex bith.

    Abhishek

    Published by: 9999999 on 8 March 2013 04:30

    Use the IW format - it will make independent NLS solution. And all you need is truncated 7th day of each month using IW:

    select  sysdate current_date,
            trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month
      from  dual
    /
    
    CURRENT_D FIRST_MON
    --------- ---------
    08-MAR-13 04-MAR-13
    
    SQL> 
    

    Here is the list of the first Monday of the month of this year:

    with t as(
              select  add_months(date '2013-1-1',level-1) dt
                from  dual
                connect by level <= 12
             )
    select  dt first_of_the_month,
            trunc(dt + 6,'iw') first_monday_the_month
      from  t
    /
    
    FIRST_OF_ FIRST_MON
    --------- ---------
    01-JAN-13 07-JAN-13
    01-FEB-13 04-FEB-13
    01-MAR-13 04-MAR-13
    01-APR-13 01-APR-13
    01-MAY-13 06-MAY-13
    01-JUN-13 03-JUN-13
    01-JUL-13 01-JUL-13
    01-AUG-13 05-AUG-13
    01-SEP-13 02-SEP-13
    01-OCT-13 07-OCT-13
    01-NOV-13 04-NOV-13
    
    FIRST_OF_ FIRST_MON
    --------- ---------
    01-DEC-13 02-DEC-13
    
    12 rows selected.
    
    SQL> 
    

    SY.

  • How to get the Date, month, year of the DateTimePicker

    Hi, I am using the DateTimePicker.

    There are several question about this command:

    1. how to get the Date, month and year?

    -With the help of myDateTime.value, I get this string ' Wed May 08 14:45 ICT 2013 '-> I have to manually analyze this? Because I need in format yyyy/mm/dd. Or can set the format of dateTimePicker.value?

    2 format on dateTimePicker self (on the user interface) is d/m/YY, I can't change to another format?

    Thank you

    dateTimePicker.value return a QDateTime not a string.

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__datetimepicker.html#property-value

    See more:

    https://developer.BlackBerry.com/Cascades/reference/QDateTime.html#date

    https://developer.BlackBerry.com/Cascades/reference/QDate.html

    You can get

    day = dateTimePicker.value.date().day()
    month = dateTimePicker.value.date().month()
    year= dateTimePicker.value.date().year()
    dateYYYYMMDD = dateTimePicker.value.date().toString(Qt::ISODate)
    dateYYYYMMDD2 = dateTimePicker.value.date().toString("YYYY/MM/DD")
    dateYYYYMMDD3 = dateTimePicker.value.toString("YYYY/MM/DD")
    
  • How to get weekly data in OBIEE

    I had a requirement to extract the data each week for 10 weeks, please let me know how to apply this logic in RPD.

    Am using OBIEE 11 G

    Thank you

    Nadia.

    Hello Nadia,.

    Try to use the Pivot table view, it will regroup by the measure.

    What happened to your last thread? Is it resolved?

    Thank you

    Sasi nanou...

  • How to make my confidence one ways c# windows application that should not blocked by antivirus Applications and how to get the third-party certificate for that?

    Hello

    I built a windows c# application that accesses OS, printer information using WMI query, monitor keyboard strokes overall Win32 API and calls others our executables too.

    Whenever I try to deploy it to computers to our customers, it is getting blocked by antivirus applications.

    If I want to make my request as being approved, we mean that it shouldn't be blocked by antivirus applications.

    How to get the certificate of trustee for my application? Even I am ready to make my request as registered product.

    Kindly let me know the procedures, solutions.

    Thank you

    Senthilkumar AK


    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

  • How to get the data in the table if the date is less - than two months from the current date?

    Hi all

    I have a requirement in to retrieve table data. If any of the basic date in the column data.

    I have a date field (expiration date) I need to display data which expires two months.

    Please give me a solution.

    Concerning

    Shankar

    Hi, Shankar,

    Sorry, we don't know what you want.

    If you want something which, when executed on March 13, 2014, finds all the lines where expires and is located between March 13, 2014 and may 13, 2014, inclusive,

    SELECT *- or whatever the columns that you want to

    FROM table_x

    WHERE expire > = TRUNC (SYSDATE)

    Maturity AND< add_months="" (trunc="" (sysdate)="" ,="" 2)="" +="">

    ;

    I hope that answers your question.

    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved 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

  • How to get a date on different pages?

    Hey everyone, I am working on a daily planner for the office and I have a script that automatically generates the dates but I Don t know how to get each of the dates on another page. I would appreciate if someone could help me get each date generated by the script on the next page of my 365 page document. The scrip is:

    var month = ["Jan", "Feb", "Mar", "Apr", "Peut", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "December"];

    var length = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

    var days = ["Sun", "Mon", "Tue", "Wed", "Game", "Fri", "Sam"];

    Count = 0;

    day = 0;

    months = 0;

    week = 5;

    Str = "";

    While (count < 365)

    {

    Count ++;

    "days of Str += [weekday] +", "+ (day + 1) +" "+ month [month] +"\r ";

    day ++;

    If (day > = length [month])

    {

    day = 0;

    months ++;

    If (month > 11)

    months = 0;

    }

    day of week = (day of the week + 1) % 7;

    }

    App.Selection [0] .silence = str;

    Tanks!

    Try this,

    app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

    app.activeDocument.zeroPoint = [0,0];

    {with (App.activeDocument.viewPreferences)}

    horizontalMeasurementUnits = MeasurementUnits.points;

    verticalMeasurementUnits = MeasurementUnits.points;

    rulerOrigin = RulerOrigin.pageOrigin;

    }

    var month = ["Jan", "Feb", "Mar", "Apr", "Peut", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "December"];

    var length = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

    var days = ["Sun", "Mon", "Tue", "Wed", "Game", "Fri", "Sam"];

    Count = 0;

    day = 0;

    months = 0;

    week = 5;

    Str = [];

    While (count<>

    {

    Count ++;

    "Str [count] = days [weekday] + ', ' + (day + 1) +" "+ month [month] +"\r ";

    str1 = str.toString ();

    day ++;

    If (day > = length [month])

    {

    day = 0;

    months ++;

    If (month > 11)

    months = 0;

    }

    day of week = (day of the week + 1) % 7;

    }

    for (i = 0; i<>

    {

    var myTextframe = document.pages [i].textFrames.add ({geometricBounds:[0,0,50,150]});})

    myTextframe.insertionPoints [0] .silence = str [i + 1];

    }

    Vandy

  • How to get a date to the timestamp of a file XML format

    Hello

    I'm trying to get a date from an external XML file. My XML file looks like this:


    <>http://www.NI.com/LVData">
        8.6.1
        
            Date of birth
            31/03/1983
        
     

    I can get the system to retrieve the correct XML element that shows the nested and elements , but I have no way to retrieve correctly the date. It seems as if she interprets my date seconds since 1904. I try to keep the "readable" for the end user XML, so it is important to keep this date in standard U.S. date format. I eventually uses this date to calculate the age of something. I labour code to subtract a timestamp in the format of the date to the current date and time, but I can't access it when I get back from XML.

    Starting from XML schema, it looks like the timestamp element requires a cluster... but there is no documentation on what to spend. Any ideas how to get back an XML date in this format in a simple and clean?

    Here's my current VI:

    Thank you

    Ryan

    Cambridge, MY

    Quick Tip on "bundle by name.  You don't need to consolidate all these constants where the values correspond to what is the constant of cluster at the top.  The cluster constant defines the data structure and the starting values.  Simply group the values for specific change items.

    Example of tone would be a bit cleaner.  Although the format string should use a capital T.

    As always with dealing with the time, complications could arise due to dealing with time zones and leap years.  Zones shouldn't matter for the calculation of the years since you are rounded up to years.  Although you probably want to round down rather than round at most closely. (I forgot this part in my example).  The problem with leap years when you would be only in a certain number of days of the anniversary, he would round up the age.  The number of rounded days would depend on how much on leap days that nobody has seen in their lifetime.

  • How to get api data to Analytics?

    Hi, I want to use the response to generate data for my js to customize and create a new report that does not build in obiee.

    Is there an api response data to call? How to get it?

    You have the Web service interface that allows you to run LSQL and retrieve data: http://docs.oracle.com/cd/E28280_01/bi.1111/e16364/methods.htm#BIEIT180

    Or if you just want to do a record in JS, you can always do in an analysis: using view narrative, you can pass the data from your analysis to a JS object and use any JS code, you want to do the rendering (OBIEE analysis is nothing other than the Web page in the end...)

  • extraction of data each month and year wise in a table

    Hello...

    I have a table as raw material

    indicator dateofmateria clinker OPC ppc
    35 22 23/11/2 / 2012 CS
    45 87 78 23/11/2012 D
    55 90 100 11/23/2012 P
    4 45 24/11/27/2012 CS
    52 25 48 24/11/2012 D
    58 50 103 24/11/2012 P
    5 50 25/1 / 11 / 2012 CS
    45 17 55 11/25/2012 D
    45 77 55 25/11/2012 P...
    Here P indicates that the production of material, D flag show send material and CS flags shows the closing stock respective dates.

    I just want to calculate the difference in stock for the respective dates.
    I want to calculate the difference in stock as below for example particular date 23/11/2012-

    Difference in stock (OPC) = ((SUM * (OPC) where flag P = & month = 'nov')-(* SUM * (OPC) where flag = D & month = 'nov')-(* SUM * (OPC) where flag = CS & month = 'nov') *)

    Similarly for the PPC and also clinker.

    I want to calculate the difference in stock simultaneously for all the month of a given year that is seized by use

    I m using the following question for this...
    * Select to_char(a.dateofmtrl,'mon'), sum (a.rm1) - sum (b.rm1) - sum (c.rm1) OPC, sum (a.rm2) - sum (b.rm2) - sum (c.rm2) PPC, sum (a.rm3) - sum (b.rm3) - sum (c.rm3) CLINKER
    rawmtrl_graph a.,
    b rawmtrl_graph,
    c rawmtrl_graph
    where
    TO_CHAR (a.dateofmtrl, 'yyyy') = '2012' and
    TO_CHAR (b.dateofmtrl, 'yyyy') = '2012' and
    TO_CHAR (c.dateofmtrl, 'yyyy') = '2012' and
    a.mtrl_flag = 'P' and
    b.mtrl_flag = has ' and
    'c.mtrl_flag =' CS
    To_char Group (a.dateofmtrl, 'my')
    BUT IT IS DOES NOT CALCULATE THE STOCK OF MUTUAL FUNDS, PPC, CLINKER WITH PRECISION (WHICH GIVES SOME FIGURE UNEXPECTEDLY FOR EACH MONTH OF THE YEAR).

    PLEASE HELP ME IN THIS...
    I WANT TO CALCULATE THE STOCK DIFFERENCE YEAR WISE ALSO...

    THANKS AND GREETINGS

    VISHAL AMINE

    Well your three requests were not being met, then you would have generated a Cartesian product. Try the following:

    SELECT TO_CHAR(a.dateofmtrl,'mon'),
           SUM(a.rm1) - SUM(b.rm1) - SUM(c.rm1) OPC,
           SUM(a.rm2) - SUM(b.rm2) - sum(c.rm2) PPC,
           SUM(a.rm3) - sum(b.rm3) - sum(c.rm3) CLINKER
    FROM   rawmtrl_graph a
           INNER JOIN rawmtrl_graph b
           ON a.dateofmtrl = b.dateofmtrl
           INNER JOIN rawmtrl_graph c
           ON a.dateofmtrl = c.dateofmtrl
    WHERE  to_char(a.dateofmtrl,'yyyy')='2012'
    AND    to_char(b.dateofmtrl,'yyyy')='2012'
    AND    to_char(c.dateofmtrl,'yyyy')='2012'
    AND    a.mtrl_flag='P'
    AND    b.mtrl_flag='D'
    AND    c.mtrl_flag='CS'
    GROUP BY TO_CHAR(a.dateofmtrl,'mon');
    
  • How to get the data center moref moref VM in c# using

    Hi all

    Could someone tell how to get managedobjectreference of data center using the VM moref? or any other easy way is? If anyone has examples of code in c# please share with me?

    Thank you

    Vijaya

    You can get the data center in which the virtual machine resides by the following search:

    VM Moref-> Parent (vmFolder)

    Moref folder VM-> Parent (data center)

    Parent of the virtual computer object will always be the vmFolder and the vmFolder object will always be a data center.

    For more details on the model of article inventory of vSphere, take a look at this blog post - http://www.doublecloud.org/2010/03/vsphere-inventory-structure-deep-dive/

Maybe you are looking for

  • verifying windows mail 8.1 gel

    I have a problem at the launch of Mozilla Thunderbird version 24.4.0 I have disabled all addons I use a SSD (Solid State Drive) What program launches automatically checks for new messages, when it does this the locks of program for a few seconds, not

  • How can I display search history - NOT the browser history?

    Everyone knows that Firefox keeps a history of websites you've visited. Also, by right-clicking the search box in FF, it allows you to 'search clear history. " Here are the items you have looked in the past - but not necessarily clicked by the result

  • Re: NB500 - 13 c - oc clock genrator

    Hello I want to do with oc to my netbook Toshiba NB500 - 13 c (plle50) so I want to know what my clock generator? So please if anyone knows what is the clock of this model generator then give me the number of clock generator?

  • Bluetooth on Satellite P500-16F

    Hello, I am using laptop Toshiba Satellite P500-16F and...I want to use the program "BlueSoleil" of bluetooth, but it says "hardware not detected".Now, I see the following options (with the following options under such as shown below) USB--- X UART-C

  • JavaScript does not properly

    When I visit Web sites that use JavaScript popup windows to display the content, if I click on a link, the window will not open. The same sites works well on IE even if. I have not reinstalled FF no chance. I also noticed that the Google search bar a