I'm trying to put the number of id
in the neighbor column. Something like this:
+----+-------------------+
| id | identical_with_id |
+----+-------------------+
id
is AUTO INCREMENT
and all need is getting id's number when inserting. I can do that like this:
INSERT INTO `table_name`
VALUES( NULL,
(SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'database_name' AND
TABLE_NAME = 'table_name')
);
But I don't know it will work all the time. Maybe between executing that sub-query and inserting that row, a new row (another row) get insert. In this case the number of id will not be the same as neighbor column. Hum? is that possible?
Note: Please don't tell me: "what do you need this for?"