I assume you are storing your dates in a char/varchar column - not a good
choice to start with... :-<

Assuming all the values are supposed to be stored as MM-DD-YY (anothoer
marginal choice, but the problem may not rear its head again for another 96+
years), you can do the following:

UPDATE mytable
SET mydatestr = LEFT(mydatestr, LENGTH(mydatestr) - 3)
WHERE mydatestr LIKE '__-__-__-__'

HTH,
Tore.

----- Original Message -----
From: "chip wiegand" <[EMAIL PROTECTED]>
To: "mysql" <[EMAIL PROTECTED]>
Sent: Sunday, March 02, 2003 1:46 AM
Subject: update question


> I need to make a change to a field in a table and don't know how to
> write the correct sql statement. I made an error and now have a date
> field with the year repeated twice - 01-01-03-03 - there are
> aproximately 100 rows like this, and maybe 20 or so that are formatted
> properly. How can I remove the last 3 characters while leaving other
> rows that do not have this problem alone? (other than manaully editing
> each row of course)
> Thanks,
> Chip W.
> www.wiegand.org
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to