Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

how to assign custom id in mysql

INSERT INTO document_control 
  SELECT CONCAT_WS('-', RIGHT(YEAR(CURRENT_TIMESTAMP), 2), LPAD(COUNT(*) + 1, 3, 0)) 
  FROM document_control
  WHERE LEFT(id_custom, 2) = RIGHT(YEAR(CURRENT_TIMESTAMP), 2)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #assign #custom #id #mysql
ADD COMMENT
Topic
Name
6+9 =