09.04.2014, 20:56
Well i think this is not the best idea or maybe very bad idea lol, but this is what i can suggest is:
Add a column named Just_insert to your table. Perform both queries together:
Note that '1' in end it is to set value of current inserting row to 1 and the above query reset all other valeus to 0.
There can be INSERT query or UPDATE too. Depends since you are asking for latest "Inserted"
laters you can do is:
it must be handled with care for best results
Add a column named Just_insert to your table. Perform both queries together:
pawn Код:
UPDATE `tableName` SET Just_insert = 0;
INSERT INTO `tableName` (fieldName1,...fieldNameN,Just_insert) VALUES('value1',..'valueN',1)
There can be INSERT query or UPDATE too. Depends since you are asking for latest "Inserted"
laters you can do is:
pawn Код:
SELECT `rowid` from `tableName` WHERE `Just_insert`=1;