From: | Dan Black <fireworker(at)gmail(dot)com> |
---|---|
To: | josue <josue(at)lamundial(dot)hn> |
Cc: | PgSQL General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Missing numbers |
Date: | 2005-06-01 14:48:52 |
Message-ID: | 27f6062505060107483acfbb64@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
you can also try this =)
select
o1.doc_numero+1 as first,
((select doc_numero from bdocs where id > o1.doc_numero+1 order by
doc_numero limit 1))-1 as last
from bdocs as o1
where o1.doc_numero+1 not in (select o2.doc_numero from bdocs as o2)
order by doc_numero
2005/5/31, josue <josue(at)lamundial(dot)hn>:
>
> Hello list,
>
> I need to track down the missing check numbers in a serie, table
> contains a column for check numbers and series like this:
>
> dbalm=# select doc_numero,doc_ckseriesfk from bdocs where doc_cta=1
> dbalm-# and doc_tipo='CHE' order by doc_numero;
> doc_numero | doc_ckseriesfk
> ------------+----------------
> 19200 | 856938
> 19201 | 856938
> 19215 | 856938
> 19216 | 856938
> 19219 | 856938
>
> Missing numbers are:
> from 19202 to 19214 and 19217,19218
>
> Does anyone knows a way to get that done in SQL or plpgsql, thanks in
> advance
>
> --
> Sinceramente,
> Josué Maldonado.
>
> ... "De hecho el paso de compilación a objeto suele atravesar una fase
> intermedia en que se genera un fichero en lenguaje ensamblador y se
> invoca al programa ensamblador del sistema." -- Tutorial de C
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
--
Verba volent, scripta manent
My ISP - http://www.netbynet.ru
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Buttafuoco | 2005-06-01 15:20:08 | Re: SQL question. |
Previous Message | FC | 2005-06-01 14:40:48 | SQL question. |