Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

kdb/Q How to renumber rows in table?

If I have a table like the one below:

Iteration Score
1 20
2 87
3 10

I reordered by Score descending:

ordered: `Score desc first_table;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Iteration Score
2 87
1 20
3 10

How can I then renumber the Iteration column, so the output is something like below? I am thinking of creating a new column that gets the index # of every row, then replacing the original Iteration column.

Iteration Score
1 87
2 20
3 10

>Solution :

You can sort the columns not the table:

update asc Iteration, desc Score from tab
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading