Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to select data from an sql table ordered by datetime_received but only for the current date

I am trying to select specific data only for the current date.

My query is

sql="""
SELECT * from table where company_name ='XXX' 
AND company_id != 0 ORDER BY datetime_recieved 
"""  

I don’t know what else to add, so it always selects only the current date.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Assuming you want that datetime_recieved is current date:

SELECT * FROM table 
WHERE company_name ='XXX' AND company_id != 0 AND DATE(datetime_recieved) = DATE(NOW())
ORDER BY datetime_recieved 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading