transactions - Creating a "secondary ID" in mysql -


I have a table that stores "records" and is already a primary key

  Table A ======= ID (INP) PK Auto_Increate project_id (INT) record_text (TEXT)  

This table "records" for all my projects

Example: If Project 1 had an ID of (1,5,8,9) , it is desirable to have a secondary key. As (1,2,3,4) will be desirable to store them and present them to the user.

I do not have the ability to use the transaction and I have had difficulty in thinking in a way without doing so due to concurrent issues.

Hopefully I get my problem clearly. Thanks in advance for the help.

Edit (example): Assuming composition:
ID, Project_ID, Record Text
1 Test 1 2 Testing
3 2 Testing - 4 1 Testing

My ID will be 1,2,4 for Project 1 but I want them to be 1 as 1,2,3

Looking for a way to store and display> I can not tell from your question, but if you want to present a clean numbered list to the user; I handle it in the UI; And can not even worry about storing it in the database.

If you really want to store it in DB, then I will try to use a trigger that will set the fire on the insert, and set its value there.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -