0

how to find the last dml action held on which row in a table using mysql

plz do me a favour ,

tanks in advance..

2
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by kartisathis
-1

tanks fr ur reply bt i dn knw wr d log file located....

Look in the log file.

-1

ya u r rite i dn knw hw to spell ...
1st u understood my question i dont need any log files i jst need to fetch last updated row in a table, any solution plz... to

And obviously you don't know how to spell, too. So look in the manual. If you don't know where that is located, use a search engine or read here: http://dev.mysql.com/doc/refman/5.0/en/log-file-maintenance.html

Edited by kartisathis: n/a

0

Well, if your tables don't have timestamp fields, looking in the log files is the only general solution I know of.
And just for curiosity's sake: is it especially cool to write as you do? Or are you trying to make it as hard as possible for others to understand your desires?

0

ya sorry man just for cool purpose only i reply like that and i found a solution for that the only way is to add one more column in table with default timestamp will solve this issue i think ....

this is my eg:
----------------
ALTER TABLE mytable
ADD lastmodified TIMESTAMP
DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP;

Then, to find out the last updated row,

SELECT * FROM mytable ORDER BY lastmodified DESC LIMIT 1;

if u found any option other than this means it will be usefull for me...

Well, if your tables don't have timestamp fields, looking in the log files is the only general solution I know of.
And just for curiosity's sake: is it especially cool to write as you do? Or are you trying to make it as hard as possible for others to understand your desires?

Edited by kartisathis: n/a

0

In my experience timestamp fields are not really useful because you can access your database not only through your application but also through maintenance tools (like mysql command line, phpMyAdmin etc.). If you alter values with those, also the timestamp will be altered. That may be suitable for your purposes, for mine it has been more often not. I rather have a datetime field which is updated by the application explicitly.

0

i dont understand will you please explain it briefly..

In my experience timestamp fields are not really useful because you can access your database not only through your application but also through maintenance tools (like mysql command line, phpMyAdmin etc.). If you alter values with those, also the timestamp will be altered. That may be suitable for your purposes, for mine it has been more often not. I rather have a datetime field which is updated by the application explicitly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.