I am collecting data from 12 noon on one day to 12 noon on another day and writing to the database. I need a new record for each cycle.

For example, on any given day, a new record would be written on any data past 12 noon, and as new information is gathered it will be written on this current record up until 12 noon the next day. Then the cycle will repeat itself. Any data prior to 12 noon that day up until 12 noon the previous day would be on the previous record.

I'm assuming this query would be written in the SQL WHERE statement.

The first thing I need to do is check the systems date to see if it is before noon or after noon. If it is before noon it needs to be written to that record (if one exists,if not it needs to start a new one) and vise-a-versa for after noon.

How would you write the SQL WHERE statement?