Groups | Search | Server Info | Keyboard shortcuts | Login | Register
| From | Jim H <invalid@invalid.invalid> |
|---|---|
| Newsgroups | alt.php.sql |
| Subject | Replace a field with a calculated value |
| Message-ID | <ftqa9d5dd424767s2rcs5ojfheonp7resr@4ax.com> (permalink) |
| Organization | Forte - www.forteinc.com |
| Date | 2018-02-27 14:57 +0000 |
I inherited a table that has a column named "date_entered" that contains dates formatted like 1/30/2018 that I'd like to replace with the same date formatted as 2018-01-30. How can I replace the whole content of the field (in just one record for now, but eventually every record) with a value calculated from the field being replaced? I wish I could do something like the following, but am hitting a dead end. REPLACE(date_entered, *, str_to_dat(date_entered, '%d/%m/%Y') WHERE record_no = '123'; Is something along these lines possible and how? Does replace() even allow a field name as a parameter (meaning whatever is in that field)... or a wild card meaning the whole string whatever it is, or does it only allow specific string values? Pointers to applicable functions would be nice, but a complete solution would be even better. I promise it's not homework. ;-) Jim H -- Jim H
Back to alt.php.sql | Previous | Next — Next in thread | Find similar
Replace a field with a calculated value Jim H <invalid@invalid.invalid> - 2018-02-27 14:57 +0000
Re: Replace a field with a calculated value "J.O. Aho" <user@example.net> - 2018-02-27 18:32 +0100
Re: Replace a field with a calculated value Jim H <invalid@invalid.invalid> - 2018-03-01 17:07 +0000
csiph-web