Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Posts
    40

    Unanswered: How to get first positive numbers in partition

    Let's say I have following table. I want to select 1,2,3,4 since they are the last positve Numbers. Can I do it in analytic query?
    Code:
    ID	VALUE
    1	200.00
    2	100.00
    3	1.00
    4	0.00
    5	-10.00
    6	100.00
    7	-250.00
    8	-350.00
    9	-40.00
    10	40.00
    11	0.00
    12	2.00

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What do you mean by "last" in this context?

    What's wrong with the rows with ID 6, 10 and 12?
    George
    Home | Blog

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    select id
    from my_table
    where id <
    (select min(id)
    from my_table
    where value < 0);
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  4. #4
    Join Date
    Mar 2008
    Posts
    40
    Quote Originally Posted by gvee View Post
    What do you mean by "last" in this context?

    What's wrong with the rows with ID 6, 10 and 12?
    Because before 6 there is negative number. I'm kind of trying to analyze daily log and want to know since when number has started rising. If number goes below zero I don't care about previous numbers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •