terça-feira, 19 de maio de 2020

First and Last Days of the previous week using MySQL

A bit of a challenge here, trying to get the first and last day of the previous week (Sunday and Saturday).

SELECT 
       Date_add(Date_add(Now(), INTERVAL -            Weekday(Now())-1 day),INTERVAL -7 day) 'Sunday', 
       Date_add(Date_add(Date_add(Now(), INTERVAL -    Weekday(Now())-1 day), INTERVAL 6 day),INTERVAL -7 day) 'Saturday';


Check out my new book about R Language http://www.amazon.com/dp/B00SX6WA06

Nenhum comentário:

Postar um comentário

Leave your comment here!