Previous Next

Thread: next to min value

Last post 07-23-2008 12:52 AM by Anwarhusen. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 06-23-2008, 5:12 AM

    • Anwarhusen
    • Top 500 Contributor
    • Joined on 05-13-2008, 6:25 AM
    • Posts 9
    • Anwarhusen

    next to min value

    I have input column as responsetime in milliseconds

    I want the value next to the min value, means second min value.

    If the column values are 0,5,8,9,6,4,8,6,3,4,9,2

    then I want '2' as min value (which is next to min value '0')

    Thnaks

    Anwarhusen

    Anwarhusen
    http://www.aztecsoft.com
    Please refer Log Parser help for further reference
  • 06-23-2008, 5:28 AM In reply to

    • Rovastar
    • Top 10 Contributor
    • Joined on 03-13-2008, 2:00 PM
    • London, UK
    • Posts 515
    • Rovastar

    Re: next to min value

    I don't understand what you are asking.

    Does min = minutes or min = minimum?

    Most overused word in IT is 'should' as in 'That should work!?!'
  • 06-23-2008, 5:35 AM In reply to

    • Anwarhusen
    • Top 500 Contributor
    • Joined on 05-13-2008, 6:25 AM
    • Posts 9
    • Anwarhusen

    Re: next to min value

    I want minimum value

    Anwarhusen
    http://www.aztecsoft.com
    Please refer Log Parser help for further reference
  • 07-22-2008, 9:00 AM In reply to

    • yellowdog.dave
    • Top 50 Contributor
    • Joined on 07-18-2008, 7:17 AM
    • Johannesburg, South Africa
    • Posts 51
    • yellowdog.dave

    Re: next to min value

    Hi,

    If this is still pertinent, I have given it some thought and come up with a couple of suggestions, I would like to understand more of why you would need to do this, as well as see what you are attempting to achieve. 

    Anyhow, I put your values into a text file for the purposes of this, so I have a file called values.txt that looks like this;

    0
    5
    8
    9
    6
    4
    8
    6
    3
    4
    9
    2

    I don't know why you would want the second to minimum value, if it is because you don't want the zero value, then you could do this;

    logparser "select min(Text) from values.txt where to_int(Text) > 0"

    Alternatively you can get the 2 lowest values like this;

    logparser "select top 2 Text from values.txt order by Text asc" 

    I then tried to make this into a nested select where I could get the max of the top 2, but haven't come right with it as yet. Anyone else maybe got this kind of nested select right? Maybe something like "select max(top 2 Text) from values.txt order by Text asc" - I just can't get past the syntax at this stage.

    What I did do is execute these two queries on one commandline to get what you wanted; 

    logparser -q:on "select top 2 Text from values.txt order by Text asc"|logparser "select max(Text) as Somfu from stdin"

    A feature like the Oracle rownum would also work for you. 

    Hope this helps. 

    Cheers, Dave 

     

    Yes, dear
  • 07-22-2008, 9:14 AM In reply to

    • yellowdog.dave
    • Top 50 Contributor
    • Joined on 07-18-2008, 7:17 AM
    • Johannesburg, South Africa
    • Posts 51
    • yellowdog.dave

    Re: next to min value

    yellowdog.dave:
    I just can't get past the syntax at this stage.
     

    Just worked this one out to do it one statement;

    logparser "select max(Text) from values.txt where Text IN (select top 2 Text from values.txt order by Text asc)"

     

    Yes, dear
  • 07-23-2008, 12:52 AM In reply to

    • Anwarhusen
    • Top 500 Contributor
    • Joined on 05-13-2008, 6:25 AM
    • Posts 9
    • Anwarhusen

    Re: next to min value

    Thanks Dave. I did solve it using same query.

    I wanted next to minimum,  because I have a Input file of http requests in which I need not consider the response time which is 0. If I take minimum of response time, it comes 0, which is not the correct value for any successful http request.

    Thanks Again..

    Anwarhusen
    http://www.aztecsoft.com
    Please refer Log Parser help for further reference
Page 1 of 1 (6 items)
Page view counter