Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6335195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:48:31+00:00 2026-05-24T18:48:31+00:00

I have a MySQL table in the format shown below: mysql> select event_time, count,

  • 0

I have a MySQL table in the format shown below:

mysql> select event_time, count, result, pcm_id from Events_CallMeBack_2011_08_05 WHERE pcm_id=1566;
+---------------------+-------+--------+--------+
| event_time          | count | result | pcm_id |
+---------------------+-------+--------+--------+
| 2011-08-05 23:45:04 |     0 | NULL   |   1566 |
+---------------------+-------+--------+--------+
1 row in set (0.00 sec)

The problem is that when I run an UPDATE query modifying the result column, the event_time is also being updated as a side effect. I have no clue why this is happening: I certainly don’t want the event_time field to be updated when I try to update the result column.

Here’s the query:

UPDATE Events_CallMeBack_2011_08_05 SET result ='D' WHERE pcm_id = '1566'

Here’s the resulting column after running the UPDATE statement.

mysql> select event_time, count, result, pcm_id from Events_CallMeBack_2011_08_05 WHERE pcm_id=1566;
+---------------------+-------+--------+--------+
| event_time          | count | result | pcm_id |
+---------------------+-------+--------+--------+
| 2011-08-20 19:40:21 |     0 | D      |   1566 |
+---------------------+-------+--------+--------+
1 row in set (0.00 sec)

The event_time column was update to the current local time of the mysql server.

My initial analysis is that mysql is automatically updating event_time (TIMESTAMP) column on Update statements. The CREATE TABLE statement doesn’t specify this so I’m clueless why this is happening.

Create Statement:

strSql = "CREATE TABLE " + strTableName +
"(id INT NOT NULL, event_time TIMESTAMP,....

Table is described below.

mysql> describe Events_CallMeBack_2011_08_05;


+------------+-------------+------+-----+-------------------+-----------------------------+
| Field      | Type        | Null | Key | Default           | Extra                       |
   +------------+-------------+------+-----+-------------------+-----------------------------+
| id         | int(11)     | NO   |     | NULL                  |                             |
| event_time | timestamp   | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| event_code | varchar(30) | YES  |     | NULL                         |                             |
| count      | int(11)     | YES  |     | 0                 |                             |
| result     | varchar(1)  | YES  |     | NULL              |                             |
| pcm_id     | int(11)     | NO   | PRI | NULL              | auto_increment              |
 +------------+-------------+------+-----+-------------------+-----------------------------+
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:48:32+00:00Added an answer on May 24, 2026 at 6:48 pm

    The event_time column is probably declared with the type TIMESTAMP. Columns of this type are set to the current time when the row is inserted or updated.

    Consider using DATETIME instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data in a mysql table in long / tall format (described below)
I have to load set of questions to MYSQL database table.But the table format
I have a mysql table that contains a date field in epoch time format.
I have some PHP script for export MYSQL table into Excel format, but I
I have a table in MySql related to purchase of Inventory. The table format
I have mysql table that has a column that stores xml as a string.
I have a MySQL table with approximately 3000 rows per user. One of the
I have a MySQL table containing domain names: +----+---------------+ | id | domain |
I have a MySQL table LOGIN_LOG with fields ID, PLAYER, TIMESTAMP and ACTION. ACTION
I have a mysql table that relies on the unix epoch time stamp equivalent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.