Forums

CC6: Insert Column with numered list

buonocore.letsbonus749 20 Sep, 2023
how can i insert a column with an ascending number for each row of my table?
Elita 20 Sep, 2023
Hi, you could use the primary key column in your database that you should have. Then, with Read Data function order that column Ascending.
Regards,
Elita
buonocore.letsbonus749 21 Sep, 2023
Thank you for reply but i can't use this solution because i have a list of reservations for estabilished days.
For example:
day: 25th september
Reservation for play tennis.

On 26th september I cancel reservation and I insert other data and i want a numbered list in the new data, and so on
buonocore.letsbonus749 24 Sep, 2023
i think that i can do it if i insert this mysql command :

SET @num := 0;
UPDATE `TABLE` SET id = @num := (@num+1);
ALTER TABLE `TABLE` AUTO_INCREMENT =1;

but i don't know where i can insert this code in CF8 when i create a new reservation.
You need to login to be able to post a reply.