MySQL Forums
Forum List  »  General

Re: Help with query strategy for view on table
Posted by: Peter Brawley
Date: January 15, 2019 07:00PM

A less redundant table setup would make your query much simpler to write ...

id, host, state, on_timestamp, off_timestamp default null

A row is created for a new on_time on a given host with a given state. Finding the row for writing the corresponding off_time is simple logic. Your reporting query writes itself.

Options: ReplyQuote


Subject
Written By
Posted
Re: Help with query strategy for view on table
January 15, 2019 07:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.