Answer the question
In order to leave comments, you need to log in
One table, the autoincrement for each user the?
I’d better write the question right away using an example:
1. We need a table with orders (it is common for all users of the system)
id int (11) auto_increment - auto-increment for all orders
id_user_creator int (11) - id of the user who created the order (the same user maybe both user_creator and user_for)
id_user_for int(11) - user id for which this order (the same user can be both user_creator and user_for)
2. And then here is the logic, each user has two tabs (incoming and outgoing) , depending on whether he created the order himself or someone created
3 for him. There he sees the numbering of orders not common in the field (id), although it is also visible, but purely for communication between two users.
4. And we need one more internal numbering so that we do not operate within the company with common order numbers (they can be very long and they will definitely have a jump in numbering: 12, 345, 6578), but work with their own internal numbers (1, 2, 3)
and here is a plug, the simplest solution is to create a table of orders for each user where to write it down here when creating a general order. Those. 3 tables: with general orders, and when adding each order, one entry is made in the tables of each participant to give them their internal numbers,
but can this be solved within one table or am I a dreamer?
Answer the question
In order to leave comments, you need to log in
So far, I see only a solution with separate tables for each user
table_USER-ID
id int (11) auto_increment
order_id int (11)
which will simply store all external orders and auto-increment to make order numbers for internal use
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question