Skip to content Skip to sidebar Skip to footer

How To Read From The Two Same Dates Without Input The Time

I have a query like below. SELECT occupation AS 'Contact occupation', sum(total) AS 'Quantity' FROM ( SELECT CASE WHEN contacts.occupation IS NULL THEN 'Other' WHEN trim(contacts.o

Solution 1:

if your data type is datetime then you can add:

WHERE patients.createdAt >='2018-05-22'and patients.createdAt <'2018-05-23'

because 2018-05-22 = 2018-05-22 00:00:00

if you want to input only one date, then u can use this

WHERE patients.createdAt >='2018-05-22 00:00:00'AND patients.createdAt <='2018-05-22 23:59:59'

or you can simply use this

WHERE patients.createdAt LIKE'2018-05-22%'

it will give you all of the row which has the value '2018-05-22' on it

Solution 2:

Try using ...WHERE DATE(patients.created_at) = '2018-05-22'...

Post a Comment for "How To Read From The Two Same Dates Without Input The Time"