Hallo,
One question: I had a table (InnoDB) like:
myid int(6) not null auto_increment primary key,
OrderNum int(5) not null,
Ammount double(15,2) default 0
Data example:
myid____OrderNum_____Ammount
1_______1001_________100
2_______1001_________200
3_______1002_________150
4_______1002_________250
5_______1002_________300
... etc ...
Now, I have changed structure, drop field "myid" and add new field SerialNum to have OrderNum + SerialNum as Primary key:
OrderNum int(5) not null,
SerialNum int(3) not null,
Ammount double(15,2) default 0,
Primary Key (OrderNum, SerialNum)
I want my new data to look like:
OrderNum____SerialNum____Ammount
1001________1____________100
1001________2____________200
1002________1____________150
1002________2____________250
1002________3____________300
... etc ...
My Question is: How can I assign (by MySQL commands) values to field SerialNum to auto increment WITHIN OrderNum ?
Any help ?
One question: I had a table (InnoDB) like:
myid int(6) not null auto_increment primary key,
OrderNum int(5) not null,
Ammount double(15,2) default 0
Data example:
myid____OrderNum_____Ammount
1_______1001_________100
2_______1001_________200
3_______1002_________150
4_______1002_________250
5_______1002_________300
... etc ...
Now, I have changed structure, drop field "myid" and add new field SerialNum to have OrderNum + SerialNum as Primary key:
OrderNum int(5) not null,
SerialNum int(3) not null,
Ammount double(15,2) default 0,
Primary Key (OrderNum, SerialNum)
I want my new data to look like:
OrderNum____SerialNum____Ammount
1001________1____________100
1001________2____________200
1002________1____________150
1002________2____________250
1002________3____________300
... etc ...
My Question is: How can I assign (by MySQL commands) values to field SerialNum to auto increment WITHIN OrderNum ?
Any help ?