Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

3 diferent autoincrement fields depending on foren key (1 reply)

$
0
0
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?

Viewing all articles
Browse latest Browse all 1954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>