mercredi 11 mars 2015

SQL UPDATE using SELECT

I have a table t1:



date | timestamp
2015-02-01 00:00:00
2015-02-01 00:00:00
2015-02-02 00:00:00
2015:02:03 00:00:00


I am trying to update the value in date, of just the date from timestamp.


This is what I am using:



update t1 set date = (select date(timestamp) from t1);


but it sets all values to the same as the 1st row?


Aucun commentaire:

Enregistrer un commentaire