Hello,
Can someone help me figure out a very fast query that can determine the date of the first day of the week (assuming Monday is the first day) for a given date?
For instance, for today, 03/21/2013 I would like to get Monday, 03/18/2013, as a result.
Thanks!
Query to Determine First Day of the Week
Moderator: NorbertKrupa
Query to Determine First Day of the Week
Have a GREAT day!
Re: Query to Determine First Day of the Week
Sarah,
You are in luck! Vertica has a function to do that:
Refer to the post viewtopic.php?f=63&t=375&p=1189&hilit=date_trunc#p1189 for more examples that use the date_trunc function.
You are in luck! Vertica has a function to do that:
Code: Select all
dbadmin=> SELECT date_trunc('week', DATE '03/21/2013');
date_trunc
---------------------
2013-03-18 00:00:00
(1 row)
Thanks,
Juliette
Juliette