On 12-Jun-2003 Wong Zach-CHZ013 wrote:
> Hi
> 1 - I have a column whose datatype is longtext. Its content is
> 08/06/2003;
> I created a new column whose datatype is DATE. Its content is null now.
> How do write a SQL statement that
> inputs each row from 08/06/2003 in the
> old column to 2003-08-06 in a new column ?
> 
> Eg:
> old column name - my_date
> new column name - my_new_date
> 
> I tried
>  select CONCAT(SUBSTRING(MY_DATE FROM 7),
> '-',SUBSTRING_INDEX(MY_DATE,'/',1), '-', MID(MY_DATE,4,2)) from dap_cell;
> 
> But how do I put this value into its corresponding row in the new column
> ?
> 

UPDATE dap_cell SET my_new_date=
  REPLACE(CONCAT(RIGHT(my_date, 4), LEFT(my_date,5)), '/','');


Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to