Prakash Madhak Prakash Madhak - 3 months ago 7x
SQL Question

how to separate Day and Night Record using Mysql Statement

In my SQL database I store date with time stamp for example like this(2015-09-21 18:02:14) I have requirement to get last time(18:02:14) is Day or Night using SQL statement

If you have another idea please share with me. I would like to use it if it fits my requirements.

In my table if have 20 record same date then get only day record how to create query like that


If the day defines from 6am to 6pm, Then

SELECT column
FROM  `tablename` 
WHERE HOUR( column ) 
AND 18;