2

I know why the warning occurs.

On a varchar(20) column set to '0000-00-00 00:00:00' format in MySQL which a numeric comparison such as:

select * from table where varchar_date_column > 0;

is performed... Then I will have warnings that say:

Warning | 1292 | Truncated incorrect DOUBLE value: '2011-03-16 06:17:04' |

So my question is: Is there a reason NOT to do it this way? Because it works in the program anyways.

Paul Carlton
  • 2,785
  • 2
  • 24
  • 42

1 Answers1

2

Since you are storing a string, you should compare it to a string.

This should give you the same results, without the warning:

select * from table where varchar_date_column > '0';
Ike Walker
  • 64,401
  • 14
  • 110
  • 109