Re: Changing a field's data in every record

Reindl Harald <[email protected]>
Newsgroups gmane.comp.db.mysql.general
Organization the lounge interactive design
Message-ID <[email protected]>

Am 20.02.2017 um 10:35 schrieb Lucio Chiappetti:
> On Sat, 18 Feb 2017, debt wrote:
>
>>     How does one "grab" the existing data and then change it? Can this
>>     be done solely in MySQL
>
> I am not sure to understand your question ... you usually manipulate
> data inside mysql ... but here it seems to me you are not talking of
> changing the data VALUE (UPDATE table SET column=new value WHERE ...)
> but of changing the DATA TYPE (ALTER TABLE table CHANGE or ALTER TABLE
> table MODIFY depending on whether ypou change the column name too) or
> even of (just) changing the FORMAT in which a value is displayed ...

but what he needs is a "select field from bla; foreach($data as 
$row){str_replace('x', 'y'); update table" for every record and he would 
like to do it in pure sql

>>     Is there a formula to change the format of the data in a single
>>     field in every record of a table?  She has a "timestamp??? in a
>>     text field formatted as 2017|02|16|04|58|42 and she wants to
>>     convert it to a more human readable format like 2017-02-16 @
>>     04:58:42
>
> curious ... the default format for a time stamp is very similar to the
> latter (except for you funny at-sign) :
>
> mysql> select time from north33 limit 1;
> +---------------------+
> | time                |
> +---------------------+
> | 2013-01-22 12:47:47 |
> +---------------------+

and what has this to do with a TEXTFILED CONTAINING STRINGS LIKE 
"2017|02|16|04|58|42" - you need to understand what you quote first 
before you can comment it.......

> and only if I cast it to an integer I get the other form
>
> mysql> select time+0 from north33 limit 1;
> +----------------+
> | time+0         |
> +----------------+
> | 20130122124747 |
> +----------------+

completly unreleated to the problem

> Anyhow I advise you to read the mysql manual and in particular the
> function chapter and the "time and date function" subchapter. E.g. here
>
> https://dev.mysql.com/doc/refman/5.7/en/functions.html

problem is that you did not understand the problem of the OP at all and 
pointing blindly to the manual is useless

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.