MySQL Database - auto increment or something else for transaction numbers

Hi there,

I want to include a field in a MySQL table for transaction numbers. I want them to start with 4 letters and then about 8 numbers. The 4 letters will always be the same but the number will be different. Like this

AGPS82736485
AGPS84784830
AGPS84672691

I do not mind if the numbers follow on from one another, as long as the numbers are never the same. It might be easier to have the numbers follow on from one another:

AGPS14000812
AGPS14000813
AGPS14000814
AGPS14000815

and I do not mind if the number varies in length like this

AGPS83983
AGPS9872389732
AGPS938493
AGPS98398398

How do I do this in a MySQL table?

Matt.

One option is to use an autoincremental column as orderid, and then add the ‘AGPS’ part when you display the order number. No real need to store it every time, since it’s always the same.

Or, you could use a composite key: one column char(4) containing the ‘AGPS’ part, the other the autoincremental column.

yes - i see what you are saying about writing AGPS on the page. That will make things easier. I will start the number at say 9873284 then auto increment it.

Matt.