select only by month of a particular column - mysql

Asked

Viewed 28,159 times

3

Well I want to select with the condition that such column has determined month, and only brings results this month.

I was doing this, but it didn’t work out.

SELECT * from funcionarios where dataEntrada = month(10);

am using mysql workbeanch

1 answer

12

To be able to filter certain records within Mysql, you can do it as follows:

Filtering Records by the Day

SELECT * FROM tabela WHERE DAY(data) = 'dia_escolhido'

Filtering Records by Month

SELECT * FROM tabela WHERE MONTH(data) = 'mes_escolhido'

Filtering Records by the Year

SELECT * FROM tabela WHERE YEAR(data) = 'ano_escolhido'

Using Day, Month, Year - can filter the data correctly.

  • There are some cases of minutes and seconds ? @André Baill

Browser other questions tagged

You are not signed in. Login or sign up in order to post.