0
How could I list numbers that are missing to complete the sequence of numbers given column of my table?
see the link to view my test base: http://sqlfiddle.com/#! 9/d124553/1
See below my select to bring the sequence: note that the column 'cod_sector' does not list the number 4:
SELECT id_item_inventario,cod_setor FROM item_inventarios WHERE id_inventario='68'
Query result:
cod_sector exists in another table? can make a Join for this
– Ricardo Pontual
The numbers missing to complete the sequence do not exist in any other table. The only thing I have to relate is an initial sector number and final sector Example: 'initial sector =1' and 'final sector =5'.
– Hugo Rutemberg
"How could I list numbers that are missing" if they are not in any table would not be able to list (select). You can create a temporary table with all possible values, for example between 1 and 9999999, and using a Join list only those that do not exist in the table "item_inventarios"
– Ricardo Pontual
Need to be in SQL that? I believe the code would be easier
– Ronaldo Araújo Alves
I would like to run in Sql. but if it is too complex I will have to implement in php.
– Hugo Rutemberg