MySQL Forums
Forum List  »  InnoDB

3 diferent autoincrement fields depending on foren key
Posted by: theodor michailow
Date: February 03, 2015 10:16AM

hi there... sory for bothering i have a dilema and cant find a solution
I have 3 tables wich a conected between Service-->customers---> products
___________
|Service table |
|---------------|
|ids|name.....|
|1 |service1 |
|2 |service2 |
|3 |service3 |
----------------|
________________
customers table

ID|Name|Phone|...|IDservice1|IDservice2|IDservice3|Service_ids|
1 |nAM1|09999|...|1,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|1,,,,,,,,,,,,,,|
2 |nAM2|09949|...|,,,,,,,,,,,,,,,|1,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|2,,,,,,,,,,,,,,|
3 |nAM3|09999|...|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|1,,,,,,,,,,,,,,|3,,,,,,,,,,,,,,|
4 |nAM4|09999|...|2,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|1,,,,,,,,,,,,,,|
5 |nAM5|09999|...|3,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|1,,,,,,,,,,,,,,|
6 |nAM6|09999|...|,,,,,,,,,,,,,,,|2,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|2,,,,,,,,,,,,,,|
7 |nAM7|09999|...|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|2,,,,,,,,,,,,,,|3,,,,,,,,,,,,,,|
8 |nAM8|09999|...|4,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|1,,,,,,,,,,,,,,|
8 |nAM8|09999|...|,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,|3,,,,,,,,,,,,,,|3,,,,,,,,,,,,,,|


the ( , ) means empty space... so i want the entrys to be like this. so that if a entry is made in service 1 the IDservice1 gets a incremented buy 1 and if its in service 2 it gets +1 in IDservice2..
i hope you can understand what im trying to do... how can i do this?

Options: ReplyQuote


Subject
Views
Written By
Posted
3 diferent autoincrement fields depending on foren key
1567
February 03, 2015 10:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.