hello, I need some advice. This is my sql table order #order_id #order_reference_number #customer_id ... .... order reference number is the number i need to give to customer. it needs to be a number. when it comes to 9999 it needs to start from 1 again. how can i do this? what is the easiest way? Thanks
Before inserting the order into table u need to select max(order_reference_number) if the number is 9998 means. u add (9998 + 1) . After that insert the order. When you want to insert the next order. These time u selecting max(order_reference_number) if the number is 9999 means. u simply start from (1) and insert order.