html - Need SQL query (MS) to indicate status transition time -


I am very smart with T-SQL, but I have not been confused with spaces and partitions, and I doubt that Something is needed I have a table with two columns, datetime and status, in which the status is "on" or "off". I'm looking for a query that will give me the result of an infection offset or off.

To clarify, I have the process of reporting the status of an external object is the interval), so the factors of the OF position will be multiples of 'OT status' - I am only interested in the changes .

Alternatively, the last transition and this one (like how,

I do not see any way to do this without cursor.

Thanks to!

What version of SQL? 2012 is the Lead and Lag Operator Supported for, which should work.

  Select Leg (field) over [[field by [field [, field]] field [, field] by order]  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -