New to MSSQL
Problem:
A machine in a production line will generated and log data in the SQL database when in production i.e. EndofRunFlag = 0-Line is in production, EndofRunFlag = 1 – Line is not in production.
Data would looking something like this:
Timestamp | EndofRunFlag
03-02-2004 08:00:00:00 | 0
03-02-2004 12:00:00:00 | 1
03-02-2004 13:00:00:00 | 0
03-02-2004 17:00:00:00 | 1
03-03-2004 08:00:00:00 | 0
03-03-2004 12:00:00:00 | 1
03-03-2004 13:00:00:00 | 0
03-03-2004 17:00:00:00 | 1
I need to write a query that will tell me the number of production run during the week of 03-05-2004, based on the number of production run from the first query. I need to create another set of query base on the each production run start time and end time in order to query information during each production run. Is it possible to have one query for all that, any tips that would get me started would be greatly appreciated.