How do I find the first day of previous/next week with SQL?

I saw your article the other day on getting the first date of the current week.. But what if I wanted to get the first date of the previous week? Or the first date of next week? As you've already guessed, the SQL syntax for getting the first day of the current week will require … Continue reading How do I find the first day of previous/next week with SQL?

How do I find the first day of the current week with SQL?

Have you ever had to do weekly/monthly reporting based on SQL data retrieval? It would be pretty neat if you could get the start date of the current week/month dynamically, no? Well, there's a very straightforward way if you're using Vertica or PostgreSQL - just employ the date_trunc('period', timestamp) function. Other databases (e.g. SQL Server,  MySQL) … Continue reading How do I find the first day of the current week with SQL?

How do I calculate the remaining days until the end of a fiscal quarter?

Should you work for a public company, it is very likely that the fiscal year of your company may not be the same as the calendar year. This in turn, means, that a bunch of your analyses may need to forecast financials for the fiscal quarters, rather than the calendar ones. How could you then … Continue reading How do I calculate the remaining days until the end of a fiscal quarter?