0

before any thing I would like to thank you here is my problem

I want to write MYSQL query that select the records where insert date equal to modified date from a datetime field and ignore the time.

I tried

UPDATErealty SET modifier = creator WHERE created = updated;

but it worked with the records that was modified in the same time and I want it to ignore the time

M.M
  • 162
  • 1
  • 9
  • 3
    possible dupe of [this](http://stackoverflow.com/questions/9032047/datetime-mysql-select-only-date) – James May 22 '14 at 22:37

1 Answers1

2

date() cuts time leaving only date

UPDATE realty SET `modifier` = `creator` WHERE date(`created`) = date(`updated`);
M.M
  • 162
  • 1
  • 9
Horaciux
  • 6,322
  • 2
  • 22
  • 41
  • Thank you dear it worked perfectly more then my way because I I tried ( UPDATE `realty` SET `modifier` = `creator` WHERE `updated` between `created` AND `created` + INTERVAL 23 HOUR ) – M.M May 22 '14 at 23:00