Max & min value date wise

I have Table test with columns
name     value     values_date
A     40     01/08/2010
A     10     02/08/2010
A     10     03/08/2010
A     10     04/08/2010
A     20     03/08/2010
A     50     02/08/2010
A     50     03/08/2010
A     50     04/08/2010
B     100     01/08/2010
B     10     02/08/2010
B     20     03/08/2010
B     10     01/08/2010
B     100     11/08/2010
B     100     12/08/2010
B     100     13/08/2010
insert into test values('A','40','1/8/2010');
insert into test values('A','10','2/8/2010');
insert into test values('A','10','3/8/2010');
insert into test values('A','10','4/8/2010');
insert into test values('A','20','3/8/2010');
insert into test values('A','50','2/8/2010');
insert into test values('A','50','3/8/2010');
insert into test values('A','50','4/8/2010');
insert into test values('B','100','1/8/2010');
insert into test values('B','10','2/8/2010');
insert into test values('B','20','3/8/2010');
insert into test values('B','10','1/8/2010');
insert into test values('B','100','11/8/2010');
insert into test values('B','100','12/8/2010');
insert into test values('B','100','13/08/2010');
I want OP like
name     min_value     min_value_date     max_value     max_value_date
A     10          02/08/2010     50          04/08/2010     
B     10          01/08/2010     100          13/08/2010

Santosh.Minupurey wrote:
Hi.....
try dis,
SQL> SELECT A.NAME,A.VALUE,MIN(A.V_DATE),B.VALUE,MAX(B.V_DATE)FROM TEST A,TEST B WHERE
2  (A.NAME,A.VALUE) IN (SELECT NAME,MIN(VALUE) FROM TEST GROUP BY NAME) AND
3  (A.NAME,B.VALUE) IN (SELECT NAME,MAX(VALUE) FROM TEST GROUP BY NAME) GROUP BY A.NAME,A.VALUE,B.VALUE;
NAME            VALUE MIN(A.V_DATE)        VALUE MAX(B.V_DATE)
A                  10 2/8/2010                50 4/8/2010
B                  10 1/8/2010               100 13/08/2010Regards,
Santosh.MinupureyHere is another way using the FIRST and LAST functions
SQL>select name,
  2  min(value) min_value,
  3  min(v_date) keep (dense_rank first order by value) min_value_date,
  4  max(value) max_value,
  5  max(v_date) keep (dense_rank last order by value) max_value_date
  6  from test
  7  group by name;
N        MIN_VALUE MIN_VALUE_D        MAX_VALUE MAX_VALUE_D
A               10 02-AUG-2010               50 04-AUG-2010
B               10 01-AUG-2010              100 13-AUG-2010For more info, check http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#i1007059

Similar Messages

  • How to find out the max/min value of one field corresponding to a second field in HANA through graphical way.

    Hi,
    I am trying to find out the latest delivery date(EINDT)  for each purchasing document (EBELN) through graphical way.
    The view contains other fields apart from the above mentioned two fields.
    When only the two fields (EBELN, EINDT) are there, then in semantics, I can select 'Max' as aggregation to get the maximum value for each document.
    If I do like this, then I need to join more than 3 views and also so many joins in calculation view. Taking so much time for data preview.
    Hence , please help me in getting the solution while the view contains other fields also.
    Thanks in advance.
    Thanks,
    Jyothirmayi

    Hi Sreehari/Vinoth,
    Thank you for your replies.
    if only two fields are then I can get the max/min values of one field corresponding to other field.
    But more than two fields are there with different values, then let me know how to find out the max/min value of a particular filed corresponding to the 2nd field with other fields also should be in the output.
    I hope you understood my issue.Please revert in case of questions.
    Thanks & Regards,
    Jyothirmayi

  • Max,min value

    Hi all
    create table temptable(MSISDN int,topupvalue float,topupdate date)I want to fetch msisdn,max(topupvalue),topupdate,min(topupvalue),topupdate from temptable
    insert into temptable values (13212324,12.00,'11-JAN-2012');
    insert into temptable values (13212324,5.00,'10-JAN-2012');
    insert into temptable values (13212324,6.00,'8-JAN-2012');
    insert into temptable values (13212324,7.00,'1-JAN-2012');
    insert into temptable values (13212324,1.00,'16-JAN-2012');
    insert into temptable values (13212325,11.00,'11-JAN-2012');
    insert into temptable values (13212325,35.00,'10-JAN-2012');
    insert into temptable values (13212325,56.00,'8-JAN-2012');
    insert into temptable values (13212325,77.00,'1-JAN-2012');
    insert into temptable values (13212325,81.00,'16-JAN-2012');I want to get msisdn it's max topup value and corresponding topupdate ,min topup value and it's corresponding topupdate

    try this [not tested]
    select
         msisdn,
         max(max_topupvalue) max_topupvalue,
         max(max_topupvalue) max_topupvalue,
         max(min_topupvalue) min_topupvalue,
         max(min_topupdate) min_topupdate
    from
         select
              msisdn,
              maxtv max_topupvalue,
              case when topupvalue=maxtv then topupdate else null end max_topupdate,
              mintv min_topupvalue,
              case when topupvalue=mintv then topupdate else null end min_topupdate
         from
              select
                   msisdn,
                   topupvalue,
                   max(topupvalue) over (partition by msisdn) maxtv,
                   topupdate,
                   min(topupvalue) over (partition by msisdn) mintv
              from
                   temptable
    group by msisdn

  • Is there an easy way to make JSpinner wrap around at max/min values?

    I have several pages with a couple dozen JSpinners to set various values - mostly numeric, but some are not.
    I would like to make them wrap around when either the max or min values are reached.
    Is there an easy way to do this?
    I was hoping for something like an "enableWraparound" property, but I haven't found such an animal.
    I suspect I could add value change listeners to all the components and do it by brute force,
    but there are too many spinners scattered around to make that an option I would like to take.
    Any suggestions?
    Thanks.

    Ok, it looks like custom spinner models are the way to go.
    Hopefully, I can create a couple that are generic enough to meet my requirements without too much pain.
    It looks like the ones I have already created will be easy enough to modify.
    Thanks for the feedback.

  • Displaying Max/Min values with time for analog signals.

    I am sampling analog inputs. I simply want to display the max and min values with the time they occurred. This seems simple but I am new to LabView and can't find a Vi to do this.

    Here's the code. When you run the demo program, you'll see three traces: Green is the max so far, Red is the min so far, and White is the current signal value.
    As the input value cycles, you'll see the two limit values track its extremes. If you have any questions about how it works, just holler.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    min-max_plotter.vi ‏82 KB
    min-max_tester.vi ‏37 KB

  • Find the abs(max/min) value error.

    Hi,  SAP experts
    Now I want to find the Abs(max) and Abs(min), (you know, for the displacement, if we want to find the max and min, we have to consider it both "+" and "-"), I use the code:
    local numbervar i;
    local currencyVar min;
    local currencyVar max;
    For i := 1 to GetNumRows-1 do
        If i = 1 then
            min := GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex);
            max := GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex);
        else
            If Abs(GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex)) <= Abs(min) then
                min := GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex);
            If Abs(GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex)) >=  Abs(max) then
                max := GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex);
    if CurrentFieldValue In [max, min] then
        crBold
    else
        crRegular
    But it seems not correct, why?

    Hi Hu,
    See if this works:
    local numbervar i;
    local currencyVar min;
    local currencyVar max;
    For i := 1 to GetNumRows-1 do
        If i = 1 then
            min := GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex);
            max := GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex);
        else
            If Abs(GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex)) <= Abs(min) then
                min := Abs(GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex));
            If Abs(GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex)) >=  Abs(max) then
                max := Abs(GridValueAt(i, CurrentColumnIndex, CurrentSummaryIndex));
    if Abs(CurrentFieldValue) In [max, min] then
        crBold
    else
        crRegular
    -Abhilash

  • New solution for Limit the value in JSpinner with changable max/min value

    I have ever stuck with a problem like that :
    1. My application need to get two int value A and B that user input.
    I use two JSpinner with Number format model.
    named in jSpinnerFrom (A value get from) jSpinnerTo (B value get from)
    2. The request is that :
    two value can be any Integer, But the value of (B - A) can not more than 1000.
    I use changeListener added into the JSpinner, when use set value make (B-A) larger than 1000, I set value back.
    But when user press mouse on arrow button, the value will be increase automaticaly, and at last the value can not set back that make (B-A) not larger than 1000.
    3. So I get the BasicArrowButton of the jSpinnerFrom and jSPinnerTo,
    and add a mouselistener on the arrowbutton. When mouseReleased, then chen the value (B-A), if it is larger than 1000, then set it back the proper value.
    Thus I can make the min/max value in the JSpinner be changable, and limit the two input value be in range of 1 - 1000
    Post this wish be help for any one has thus familar request.
    Good Luck!!

    Something like this might work
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    class Spin extends JFrame implements ChangeListener
      JSpinner spinner1;
      JSpinner spinner2;
      JPanel jp;
      public Spin()
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(200,75);
        setLocation(400,300);
        spinner1 = new JSpinner(new SpinnerNumberModel(1000, 1000, 9999, 5));
        spinner1.addChangeListener(this);
        spinner2 = new JSpinner(new SpinnerNumberModel(0, 0, 1000, 5));
        jp = new JPanel();
        jp.add(spinner1);
        jp.add(spinner2);
        getContentPane().add(jp);
      public void stateChanged(ChangeEvent ce)
        int s1 = ((Integer)spinner1.getValue()).intValue();
        jp.remove(spinner2);
        spinner2 = new JSpinner(new SpinnerNumberModel(s1-1000, s1-1000, s1, 5));
        jp.add(spinner2);
        validate();
      public static void main(String[] args) {new Spin().setVisible(true);}
    }

  • Finding MAX/MIN value

    Hi!
    There are different records in PSA.
    When I load to DSO I need only max value for key figure.
    For example, data in PSA:
    Char| KF
    1| 2
    1| 5
    1| 3
    2| 1
    If I use Overwrite then result is:
    1| 3
    2| 1
    If I use Sum then result is:
    1| 10
    2| 1
    But I need followed reult:
    1| 5
    2| 1
    How can I find max value for KF without using FM or Programs?

    Hi,
    You can do this in a Start routine.
    Sort the source package and copy the records with the max value to another internal table which has the same structure as your source package.
    In the end of the routine, over write records in source package with the records in the internal table.
    THis will help.
    - Jaimin

  • How to dynamic to add +/- 10 to the y axis based on returned data value max/min

    Hi,
    We have two ways to extract/present the data/chart. One is using SQL Reporting and one is using EXCEL. However, we hardcoded the max/min value on y asix to various data set so the chart looks good. However, SQL reporting seems using auto on the y asix so
    when some values are 0, it just overlapped with the x-asix as dipicture below (left hand side is SQL reporting and right hand size is EXCEL) 
    Please advise how to add an +/- interval on the y asix based on the max/min returned data value (e.g if the max returned value is 100 and min returned value is 0, the max value on y asix would be 110 and min value of y asix would be -10)
    Thanks

    Hi kkcci88888,
    According to your description, there is a chart in the report, you want to set vertical axis range and interval dynamically. For example, if the max value of the column is 100 and min value is 0, the max value on y axis would be 110 and min value of y axis
    would be -10. If that is the case, please refer to the following steps:
      1. In design surface, right-click Y axis and open Vertical Axis Properties dialog box.
      2. In Axis Options pane, click (fx) button next to Minimum and type the expression like below:
    =Min(Fields!num.Value)- 10
      3. Click (fx) button next to Maximum and type the expression like below:
    =Max(Fields!num.Value)+ 10
      4. Set Interval to 10, Interval type to Number.
    The following screenshots are for your reference:
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu

  • How do you create a max/min for a series of input in labview 2010

    with labview is there a way to get max/min values from a series of inputs? I want it to graph the data and keep track of what the highest and lowest values were. I am using Labview 2010

    While you don't really define what you mean by a "Series of inputs", maybe Array Min&Max PrByPt might be of interest.
    (For better help, attach a simplified VI that shows typical data.)
    LabVIEW Champion . Do more with less code and in less time .

  • Record the coordinate point of the max y value on chart

    I am trying to figure out how to get labVIEW to record the x and y values at the coordinate point of the location of the max y value.  In other words, at the max y value, record the x and y values at that point.  I though of using the max and min fn under signal processing but it only records the maximum value on one axis.  I am using labVIEW 8.6.  Any suggestions?  Also I am very new to LabVIEW so I appologize if this is a really simple problem.

    What do you mean by : "My max/min array does not seem to store the max/min values."
    An array is a serie of numbers, so unless they are all the same there has to be a minimum and a maximum. 
    What do you mean by : "...return to zero within a second or two..."
    Does your vi hang for a second or two or what? 
    What do you mean by : '...to stay at the max value until I exceed it?"
    Exceed what? A loop that acquire data continuously or what?  
    The solution provided by smercurio is ok for a static array but I start thinking that you acquire data and want to find the maximum value over different blocks of data.
    Is that it?
    If yes then you need a shift register that retain the maximum of passed blocks. With each new block compare the maximum of that block with the shift register value. If it's larger keep this one as a new maximum. If it isn't larger keep the original value.
    Message Edited by Alain S on 07-03-2009 07:17 PM

  • How to get the MAX,MIN from the below table...

    Hi,
    Database is SQL2012 R2 Express and I have a table and would like to dig out the MAX,MIN value of a specifiied date (e.g 2014-11-03)
    Thanks

    Nope... It still output more than 1 value on the same date...
    DL-01-BAT 13.00753 13.00753 10/10/2014
    DL-01-BAT 13.01342 13.01342 10/10/2014
    DL-01-BAT 13.02706 13.02706 10/10/2014
    DL-01-BAT 13.03485 13.03485 10/10/2014
    Raw data is
    DL-01-BAT 13.00753 13.00753 10/10/2014 20:00
    DL-01-BAT 13.01342 13.01342 10/10/2014 21:00
    DL-01-BAT 13.02706 13.02706 10/10/2014 22:00
    DL-01-BAT 13.03485 13.03485 10/10/2014 23:00
    You mean after applying my suggestion?
    I dont think so
    See illustration below
    declare @t table
    Item VARCHAR(10), Reading VarChar(50),DateTimeReading DATETIME)
    INSERT @t
    VALUES
    ('DL-01-BAT', 13.00753,'10/10/2014 20:00'),
    ('DL-01-BAT', 13.01342,'10/10/2014 21:00'),
    ('DL-01-BAT', 13.02706,'10/10/2014 22:00'),
    ('DL-01-BAT', 13.03485,'10/10/2014 23:00')
    DECLARE @Date datetime = '20141010'
    SELECT Item,
    MAX(Reading) AS [Max],
    MIN(Reading) AS [Min],
    DATEADD(dd,DATEDIFF(dd,0,DateTimeReading),0) AS [Date]
    FROM @t
    WHERE DateTimeReading >= @Date
    AND DateTimeReading < DATEADD(dd,1,@Date)
    GROUP BY Item, DATEADD(dd,DATEDIFF(dd,0,DateTimeReading),0)
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to Programmatically Set the limit (max, min input) of a control inside a cluster?

    I want to programmatically set the limit (max, min input) of a control inside a cluster. (see attached VI).
    The max, min value will be read from a file. The input of the control must be within the range defined by the max and min value.
    Can anyone tell me how to do it?
    Thanks a lot for your kind help.
    Xiaogang

    Accessing the properties of a cluster (or array) is not a trivial operation until you have done it once. It's a two step (at least) process : first, ask for a reference (array of...) to the objects contained in the cluster, then tell LV what kind of object you are adressing.
    See the attachment.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    How to set limit[1].vi ‏52 KB

  • Query Designer in BI - How to cumulate value and get the Max and Min value.

    I want to create a report with  query designe of BI 7r. is it possible. the data from the cube will be
    Year ,           Exposed Quantity
    1999 ,             200
    2000 ,            100
    2001 ,            -100
    2002 ,             300
    2003 ,           - 200
    2004 ,             100
    2005 ,            -200
    Calculation should be - Refer the cumulative value field
    Year  ,          Exposure Quantity ,   Cumulative value
    1999  ,            200   ,                             200
    2000  ,            100  ,                              300
    2001  ,           -100 ,                               200
    2002  ,            300  ,                              500
    2003  ,          - 200  ,                              300
    2004  ,            100  ,                              400
    2005  ,           -200  ,                              -200
    An the out put of the report  should be Max value ie 500 and Min Value -200.
    My question is that is it possible to do in the front end ie in the Query Designer (BI 7) If so how.
    Edited by: Parakadavil Chacko Mathew on Oct 8, 2009 3:52 AM

    Hi there,
    Create 4 column,
    1st will show regular values for the key figure,
    2nd will show Cumulative value, in Query Designer, Just right click on the this 2nd key figure properties, calculation tab there you can check on Cumulated option, and define the calculation direction as Calculate along the Column.
    3rd will show Minimum value , Just right click on the this 2nd key figure properties, calculation tab calculate single valuea as minimum.
    4th will show Minimum value , Just right click on the this 2nd key figure properties, calculation tab calculate single valuea as Maximum.
    Regards,
    Rajdeep Rane.

  • How to use min-max functions for date in transformation in bpel?

    Hi,
    I have a requirement where i need to map earliest date of a Source field among all the dates to a target field in a transformation file in BPEL. There are functions called max-value-among-nodeset and min-value-among-nodeset in mathematical functions but they can be used only for numbers and strings.How to do these with dates?
    Thanks,
    Prasanna

    I exactly have the same requirement.Are you able to solve this?
    Its very urgent.Please help me.

Maybe you are looking for

  • Hi all, I'm trying to update my Adobe Apps, but I'm receiving next errors. Could you help me?

    Adobe Photoshop 2014.2 Se ha producido un error al descargar esta actualización. Salga e inténtelo de nuevo más tarde. Código de error: U43M1D207 Actualización de SpeedGrade CC 2014.1 Se ha producido un error al descargar esta actualización. Salga e

  • Importing music and video through command line

    I can't seem to get the following to work at the DOS prompt (W2000)- C:\"Program Files"\iTunes\iTunes.exe "C:\TEMP_MEDIA" I am running iTunes 7.0.2.16. iTunes launches with the above, but the files are not imported into iTunes from the directory. The

  • N 97 FM Transmitter PROBLEM WITH CHARGER / QUALITY...

    Helllo. got my RM 505 FW 11  with several problems concerning the built-in FM Transmitter. When used under UMTS 3G EPLUS with LCG Jukebox 2.41 the Transmit Power seems to Low. I tested it with freq. 88.30 , 88.60 ,96.00 and 107.00 for example. Always

  • Issues with Samsung Startosphere

    Okay so first of all I got the stratosphere less then a year ago. It was fine for the first few months but then it started not charging or holding charge so I went to the verizon store and they said to buy a new battery and a new charger so I did...

  • Web Gallery Feature Requests

    All these requests pertain to Lightrooms' (Bluefire) Flash Gallery I would love to see: 1: Is it possible to consider adding the option of filenames to the thumbnails in addition to the large images in the AMG? I think this would be a valuable featur