0
Hello. I have a stock drive in month 1, month 2, month 3, month 4, month 5... how do I create rule for appearing only stock drives in month 3? Remembering that the field is TIMESTAMP.
0
Hello. I have a stock drive in month 1, month 2, month 3, month 4, month 5... how do I create rule for appearing only stock drives in month 3? Remembering that the field is TIMESTAMP.
1
There are many ways to do it.
Using BETWEEN
to pull a break:
SELECT *
FROM tabela
WHERE timestamp BETWEEN '01/03/2018 00:00:00' AND '31/03/2018 23:59:59'
Using MONTH
to filter only the month:
SELECT *
FROM tabela
WHERE MONTH(timestamp) = 3
Using MONTH
and YEAR
to filter month and year:
SELECT *
FROM tabela
WHERE MONTH(timestamp) = 3
AND YEAR(timestamp) IN (2017,2018)
Very good and complete documentation: Date and Time Functions - Mysql
Browser other questions tagged sql
You are not signed in. Login or sign up in order to post.
Hello. Great!!! I believe that the first form will serve. Thank you and!!
– Wagner
@Wagner if the answer solved, mark as correct
– rLinhares