I have table with column name status which store the time in seconds like 1288072079 I want to calculate the diffrence between current time and the stored time if the diffrence will be less than 20 minutes means 1200 seconds it should return the effected rows to show the online status.
Use the function UNIX_TIMESTAMP(). Should be something like: SELECT some_columns, (UNIX_TIMESTAMP() - timestamp_column) AS seconds_difference FROM my_table WHERE seconds_difference < 1200;