Skip to content

Tag: date

Comparing TIMEDIFF in MySQL

I have these following data: and the following query that I want to use to find all the entries where the timediff is lesser than 50 hours The second row should be returned because it’s lesser than 50 hours, but the first row, which the timediff is more than 50 hours keep returning as well. It returns a…

Convert iso_week to calendar date in SQL

I’ve been searching though the archives without finding what I am looking for- I’d be happy for some guidance. I have a data set where I want to report aggregated number of appointments by provider (STAFFID) and work week, the latter defined by the week’s Monday date. I’ve played with …

SQL – Get result of current year only

How can I get the result of the current year using SQL? I have a table that has a column date with the format yyyy-mm-dd. Now, I want to do select query that only returns the current year result. The pseudo code should be like: The result should be as following: How can I do this? Answer Use YEAR() to