You can do some trickery with auto increment fields and multiple-column
indexes. Have a look at http://www.bitbybit.dk/carsten/blog/?p=131
Beware that this is apparently a MyISAM-specific trick.
On Tue, 6 Apr 2010 16:02:48 +0530, "Suryanarayanan"
> I am new to mysql and am trying to develop a package in php using mysql
> backend database.
> I have a table in mysql which has a customer code which is alpha
> Eg: J0001 and name and address of the customer. The alphabet signifies
> first letter of the name of the customer viz. James. I want to increment
> this code to J0002 when another customer (Jones) details is entered into
> system i.e J0003 and so on. Can any enlightened members help me with
> code in mysql. This will be used while coding in php to update the
> with the entries made online.
> Looking forth for early replies from friends all over the world.