Hi everybody
In MySQL, in the index field, I just don't know how to check for the next available field to act has a auto-increment...
Thanks!
Check next available index has auto-increment
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
I must do this way:twigletmac wrote:Two tables with identical primary keys sounds like it's going to give you headaches and in the long run keeping them in synch is probably not going to be very easy.
In the first table (primary) I have the primary key and different fields, and in the second table, I have two keys: same key as primary table with the language key to have descriptions in different languages.
So I must do this way to support different language. For exemple, if I wish to add a new language, it will be easy.
Table 1 is assumed to have the auto_incrementing field.
Table 1: INSERT INTO table (field) VALUES ('value');
Table 2: INSERT INTO other_table (primary_key, field) VALUES (LAST_INSERT_ID(), 'value');
Table 1: INSERT INTO table (field) VALUES ('value');
Table 2: INSERT INTO other_table (primary_key, field) VALUES (LAST_INSERT_ID(), 'value');
Actually, it would probably be easier to set a primary key of the Id and the language of the article. And make the language of the article (or whatever content it is) and ENUM. Then simply select on that.So I must do this way to support different language. For exemple, if I wish to add a new language, it will be easy.