-2
I’m doing the following command:
SELECT h.h_dia FROM hh h WHERE h.h_dia = 20180621 GROUP BY h.h_dia
-2
I’m doing the following command:
SELECT h.h_dia FROM hh h WHERE h.h_dia = 20180621 GROUP BY h.h_dia
0
Your select must be so:
SELECT h.h_dia FROM hh h WHERE cast(h.h_dia as date) = '2018-06-21' GROUP BY h.h_dia;
When the field is date and time, if you put in the filter only the date it will understand that the time is 00:00:00 and will not return correctly, so as you want to filter only by date, you must convert the field to date only.
If you want to filter by date and time do it as follows:
SELECT h.h_dia FROM hh h WHERE h.h_dia = '2018-06-21 10:45:00' GROUP BY h.h_dia;
Browser other questions tagged mysql sql database table
You are not signed in. Login or sign up in order to post.
if the format of the h_dia field is DATE and not INT try changing the date filter to: h.h_dia = '2018-06-21'
– Melissa
Returns nothing from table
– Renan Araújo
How is the value in the h_dia column? And what is the type of the column in the table?
– Matheus Ribeiro
2017-07-03 08:00:00 so for example
– Renan Araújo