On Sun, 2 Mar 2003 02:06:40 -0500 "Tore Bostrup" <[EMAIL PROTECTED]> wrote:
> I assume you are storing your dates in a char/varchar column - not a > good choice to start with... :-< yes, varchar. I'm still learning this stuff, and experimenting with it. > 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: heh, heh, I don't think I'll be around another 96 years to find out. Lets see, I would be 139 years old. Probably wouldn't be pushing too many keys on the keyboard at that age. This particular database/tables are not for business use, just my own learning. > UPDATE mytable > SET mydatestr = LEFT(mydatestr, LENGTH(mydatestr) - 3) > WHERE mydatestr LIKE '__-__-__-__' Thanks for the help, worked great. I didn't know about the underscore being a wildcard character. I should look for a better MySQL book, the ones I have don't cover that info. Any suggestions for one that does? -- Chip > 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 > > --------------------------------------------------------------------- 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