I've made a program that takes details from a person, and puts them into a MySQL database. I've set an order_id to auto_increment, but I also want a group_order_id: So if 10 people make an order as a group, I want them all to have the same group_order_id, but individual order_ids. I can't set group_order_id to auto increment as it wont give the group their shared IDs.
I was just wondering if anyone knew how to do this. The end of the order would be triggered by an event such as a button, so maybe I could just check to see what the last group_order_id is, then just do something to that.
But I want to know if there a way of doing this in mysql? I'm a bit of a database noob, so take it easy
mysql> DESCRIBE order_details;
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| order_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
|group_order_id| int(10) unsigned| NO | | NULL | |
| f_name | varchar(20) | YES | | NULL | |
| l_name | varchar(20) | YES | | NULL | |
| date | varchar(10) | YES | | NULL | |
| no_people | int(10) unsigned | YES | | NULL | |
| hire_length | int(10) unsigned | YES | | NULL | |
| Bike_Type | varchar(25) | YES | | NULL | |
| Frame_Size | varchar(10) | YES | | NULL | |
| Helmet_Size | int(10) unsigned | YES | | NULL | |
| Panniers | varchar(5) | YES | | NULL | |
| Helmet | varchar(5) | YES | | NULL | |
| Sex | varchar(10) | YES | | NULL | |
+-------------+------------------+------+-----+---------+----------------+
Thanks in advance.