2
Have a table with the following structure:
------------------------
Codigo | Num_doc | Serie
------------------------
1 | 1 | 1
2 | 1 | 2
3 | 3 | 2
4 | 2 | 1
5 | 3 | 1
6 | 5 | 1
7 | 7 | 1
8 | 5 | 2
------------------------
I need to perform a select to get the Num_doc
that "jumped" to each Serie
, I mean, the consultation needs to return me:
---------------
Num_doc | Serie
---------------
4 | 1
6 | 1
2 | 2
4 | 2
---------------
can be a process? and the document number (
Num_doc
) is the basis for the calculation?– novic
Possible duplicate of Picking Gaps in an SQL sequence
– Sorack
select Codigo from tbExemplo where Codigo not in (select Num_doc from tbExemplo)
Would that be?– Walter Felipe
Murilo, what you want is clear, at least for me. Your topic has been blocked here and there is no way to answer it. If you like, post your question in the forum "SQL Server - General Development" -> https://social.msdn.microsoft.com/Forums/sqlserver/pt-BR/home?forum=520
– José Diz
@Josédiz although he agrees with the fact that the topic is clear, as I quoted in a previous comment, this question already has an answer in the question Picking Gaps in an SQL sequence.
– Sorack