tags:

views:

39

answers:

2

hi

i want to know how to find the column value change or not

Example :

table name = exam

     a     b      c
    12a    32     sdf
    23s    df     fds

if i can search the row which c column have "fds".

Query:

    select * from exam where c='fds';

but the same time,i have to check the all the field value is change or not.

thanks in advance

A: 

Not sure I fully understand what you want to do, but by adding another column you can keep track of when the last change occurred. Either manually on each update query or, when you alter the table, you can set the CURRENT_TIMESTAMP to be the default value of the column and add an ON UPDATE CURRENT_TIMESTAMP clause so it will keep track of latest update.

Alexander Sagen
I agree. You can add a timestamp to the rows to track last_updated, and then compare the model for those rows (what you select prior to committing an update) against your proposed changes to see if they are different.
Jeff Standen
+1  A: 

Your request isn't really clear for me, what i understand is that you want to check if all columns have the same values that you want to update. If so, you can do :

SELECT * FROM exam WHERE a='23s' AND b='df' AND c='fds';

If you retrieve rows then values are unchanged else at least one of them is changed.

M42