mardi 14 novembre 2017

Update values with random date

Probably this question is asked a million times, but here it is again. I need to update a table with random date values. The table name is review and it has the following columns: review_id, created_at, entity_id, entity_pk_value, status_id, group_code. I need to update created_at for all the rows and the other values need to remain the same.

The random query that i found is this

FROM_UNIXTIME(
        UNIX_TIMESTAMP('2017-11-14 14:53:27') + FLOOR(0 + (RAND() * 63072000))
    )

What i have so far

UPDATE 'mage_review' SET review_id="",created_at=FROM_UNIXTIME(UNIX_TIMESTAMP('2017-11-14 14:53:27') + FLOOR(0 + (RAND() * 63072000))), entity_id="", entity_pk_value="", status_id="", group_code="";




Aucun commentaire:

Enregistrer un commentaire