Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL to select records for a specific date given created time and modified time
    primarykey
    data
    text
    <h2>CONTEXT</h2> <p>I've been asked by my management to "analyze" our issue tracking database - they use it to catalog our internal bugs, etc. My SQL and DB skills are <strong>primitive</strong> so I need some help.</p> <h2>THE DATA</h2> <p>I received a single table of 3 million records. It accounts for 250K bugs. Each revision of a bug is a row in the table. That's how 250K bugs ends up in 3 million records.</p> <p>The data looks like this</p> <pre><code>BugID Created Modified AssignedTo Priority Status 27 mar-31-2003 mar-31-2003 mel 2 Open 27 mar-31-2003 apr-01-2003 mel 1 Open 27 mar-31-2003 apr-10-2003 steve 1 Fixed </code></pre> <p>Thus, I have the complete history of every bug and can see how they have evolved every day.</p> <h2>WHAT I WANT TO ACCOMPLISH</h2> <p>I have a lot of things I've been asked to provide as reports. But the most basic question I have been asked to do is enable someone to look at the bugs as they existed at a specific date.</p> <p>For example, if someone asked for all the bugs on mar 1 2003, then bug 27 isn't in the result because it doesn't exist on that day. Or if they asked for the bugs on April 7 they'd see bug 27 and that still marked as open</p> <h2>MY SPECIFIC QUESTION</h2> <p>Given the schema I outlined, what SQL query will provide a view of the records on a specific date?</p> <h2>TECHNICAL DETAILS</h2> <p>I am using Microsoft SQL Server 2008</p> <h2>WHAT I'VE TRIED SO FAR</h2> <p>As I said my SQL skills are primitive. I was able use WHERE clauses to filter out modifications made after the target date and bugs that didn't exist by the target date, but wasn't able to find the single record happened on that date. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload