lundi 12 octobre 2020

Random date in postgres

I'm trying to generate a random date on postgres as the enddate and a second date a week before as the startdate. I tried with the following request but it doesn't work. : / Thank you in advance for your help.

SELECT date((current_date - trunc(random() * 365) * '1 day'::interval)) as enddate,
date(enddate - '7 day'::interval) as startdate;



Aucun commentaire:

Enregistrer un commentaire