2
I’m not really close to the database, and actually I don’t even need such functionality, but just out of curiosity, it’s possible to create in Runtime, that is, during SELECT, a sequential numbering to be used in substitution for the auto-incremental values of a primary key, without changing any value, only facilitating the work of the language server-side?
Consider that Sqlfiddle for example.
In it there are three tables, and the third only relates the other two. I know this kind of intermediate table has a proper name, but I don’t remember >.<
The way the simple query was mounted, when rendering an HTML from a resource of this query, if I show the column values sid would look visually strange, for example, a rowset with three records start your listing by number four.
With language server-side Simply get the current iteration index over the resource and use this value instead of the one in the column. Or even I could assemble an unordered list and renumber with CSS(3).
But it’s directly by query? It is possible?
you want to make a
order by
? or want sid to start with 1 ? which database ?– gmsantos
Never that I would be able to find this in the search >.< Don’t you want to make official an answer? Not that it is necessary, but suddenly even with a proprietary solution.
– Bruno Augusto
ORACLE has a pseudocolumn ROWNUM that numbers (before ORDER BY) the resultset lines, would that be !?
– Motta
Reply also then @Motta. You never know when someone will have the same curiosity or even need. For me a solution in Mysql gives and leaves.
– Bruno Augusto
"I know this kind of intermediate table has a proper name, but I don’t remember"; is called resolution table or resolution object.
– ptkato
And by the way, thanks @Patrick. :)
– Bruno Augusto