Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.php.sql > #18

Replace a field with a calculated value

Path csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!newsengine.sol.net!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!post01.iad!fx36.iad.POSTED!not-for-mail
From Jim H <invalid@invalid.invalid>
Newsgroups alt.php.sql
Subject Replace a field with a calculated value
Sender Jim Higgins <invalid@invalid.invalid>
Reply-To invalid@invalid.invalid
Message-ID <ftqa9d5dd424767s2rcs5ojfheonp7resr@4ax.com> (permalink)
User-Agent ForteAgent/8.00.32.1272
X-No-Archive yes
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 27
X-Complaints-To abuse@easynews.com
Organization Forte - www.forteinc.com
X-Complaints-Info Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date Tue, 27 Feb 2018 14:57:30 +0000
X-Received-Bytes 1649
X-Received-Body-CRC 1500535676
Xref csiph.com alt.php.sql:18

Show key headers only | View raw


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 | NextNext in thread | Find similar


Thread

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