Huascar Espinoza wrote: > > How can I get the following statistics in singles SQL queries: > > Table has a sequencing number field (NRO_CORREL) and a date field = > (DATE_REF). Example (ORDER BY DATE_REF): > > NRO_CORREL DATE_REF > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D > 1 date1 > 2 date2 > 3 date3 > 5 date4 > 6 date5 > 4 date6 > 8 date7 > 9 date8 > > I need to find: > > 1) Qty. and list of regs. with lacked NRO_CORREL in the sequence > 2) Qty. and list of regs. With disordered NRO_CORREL > > Thank you! > > Hu=E1scar > ---------------------------------------------------------------- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > ---------------------------------------------------------------- > To unsubscribe send email to: oracle-l-request@xxxxxxxxxxxxx > put 'unsubscribe' in the subject line. > -- > Archives are at //www.freelists.org/archives/oracle-l/ > FAQ is at //www.freelists.org/help/fom-serve/cache/1.html > ----------------------------------------------------------------- Huascar, Have a look at the lag() and lead() analytical functions. Order by date in the window attribute of the function, and compare NRO_CORREL to lag(NRO_CORREL). -- Regards, Stephane Faroult Oriole Software ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request@xxxxxxxxxxxxx put 'unsubscribe' in the subject line. -- Archives are at //www.freelists.org/archives/oracle-l/ FAQ is at //www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------