SQL Selecting Records using comparison condition
Hello Guru,
I am still a newbie and have a SQL Question with below data
create table XXTEST1 (DOCNBR number(10),QTY number(10),BALANCE number(10));
insert into XXTEST1 (DOCNBR,QTY,BALANCE) values (973740,111,111);
insert into XXTEST1 (DOCNBR,QTY,BALANCE) values (973754,140,251);
insert into XXTEST1 (DOCNBR,QTY,BALANCE) values (973793,140,391);
insert into XXTEST1 (DOCNBR,QTY,BALANCE) values (973827,140,531);
insert into XXTEST1 (DOCNBR,QTY,BALANCE) values (973860,140,671);
insert into XXTEST1 (DOCNBR,QTY,BALANCE) values (1018097,500,1171);
DOCNBR is ID of the document, Qty and Balance is a running balance (current qty record + qty from previous record).
Output that I expect is I want to see the first record that having > 250 and all records that less than 250. for above sample, we should see