I have table named ITEMS where there should be 2 auto increment columns.

So the table structure would be:

ID   |   ITEM_ID
1    |   ITEM201521080225-001
2    |   ITEM201521080301-002
3    |   ITEM201521080345-003

The column.ITEM_ID structure is ITEMYearDayMonthHourMinute-Increment Value

I managed to Generate the ITEMYearDayMonthHourMinute value thru POST(PHP POST/ PHP Generated).

I am using MySQL and PHPMyAdmin at the moment, and I'm seeing errors if I set column.ITEM_ID to AUTO_INCREMENT

How can I make column.ITEM_ID to AUTO_INCREMENT? Is it Possible?

  • Why do you need this (which is basically storing the ID in 2 places)? Just store the 'ITEM201521080225' in item. Wherever you need this, just concat() the 2 columns. – ypercubeᵀᴹ Aug 20 '15 at 18:49
  • 1
    So, on the 21st day of the 8th month (at 02:25?) you have a new product id? What do you need the ID field? You have a unique (and probably - reasonably - natural) key? Anyway, you can't have > 1 auto_increment fields. – Vérace Aug 20 '15 at 18:57

Browse other questions tagged or ask your own question.