php - copy A table to B table with extra unique column -


in database have 2 table , orders , cart , copy cart table order table can using statement

insert orders  select *, current_timestamp()    cart

the current_timestamp() replace unique column don't want use timestamp unique , have else , because scared 2 user order in same time , have same order id

you can use current date , time epoch format uniqueness of record.

for example :-

assuming 1501216777000 in milliseconds: gmt: friday, july 28, 2017 4:39:37.216 time zone: friday, july 28, 2017 10:09:37.216 gmt+05:30

so 1501216777000 string can unique. 2 users can not place order in same time because epoch format in milliseconds.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -