Hello everyone, I have this request:

SELECT URL FROM t_links ORDER BY ID = ID + 1 DESC 

So, this request is made when the timer is triggered, each time the timer is called, the ID should increase by 1, but for some reason this only happens 1 time: (Tell me how to fix the error ...

    1 answer 1

    ORDER BY is used to specify sorting, not to change the value. If you need to change the values ​​in the table, use the UPDATE statement.

    It is strange that the request does not cause syntax errors. I wonder what kind of database it is?

    • I do not know, just the base phpmyadmin. I just need to do a sorting by increase, and after that those links are already to go (ID = ID + 1) - Angus123
    • So MySQL. He does not generate an error, but what does he do is incomprehensible. Write fine: SELECT URL FROM t_links ORDER BY ID DESC And then write a handler in C # code. - msi
    • Yes, I tried, it does not work. I need to have no IDs among the IDs, and the IDs would increase, after that it was possible to read the IDs, and other data from this cell could already be read from it. - Angus123
    • one
      Why do you want the ID to not have holes? - Modus
    • @ Angus123 What is the difference whether there are holes or not, if you need the following value in the order of cursor traversal (recordset). If the cursor is not saved between calls, remember the current value somewhere and get the following, for example: SELECT URL, ID FROM t_links where ID = (select (max (ID) from t_links where id <previous_value_ID) - msi