Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL - Modify datetime columns based on additional datetime columns
    text
    copied!<p>I had a rough time figuring out how to title this, but here's an explanation...</p> <p>I have two tables</p> <p>Table #1:</p> <pre><code>-------------------------------------------------------------- | id | start | end | duration | ------------------------------------------------------------- | 1 | 2013-10-01 09:00:00 | 2013-10-01 09:30:00 | 30 | ------------------------------------------------------------- | 2 | 2013-10-02 10:00:00 | 2013-10-02 10:30:00 | 30 | -------------------------------------------------------------- | int | datetime | datetime | int | -------------------------------------------------------------- </code></pre> <p>Table #2:</p> <pre><code>--------------------------------------------------- | id | start | end | --------------------------------------------------- | 3 | 2013-10-01 09:00:00 | 2013-10-01 17:00:00 | --------------------------------------------------- | 4 | 2013-10-02 09:00:00 | 2013-10-02 17:00:00 | --------------------------------------------------- | int | datetime | datetime | --------------------------------------------------- </code></pre> <p>What I'm trying to do is grab the all records from table #2 match any table #1 rows that fall on the same date and within the same datetime and modify the result set by removing the times from table #1...</p> <p>An example result would be...</p> <pre><code>--------------------------------------------------------- | table2id | start | end | --------------------------------------------------------- | 3 | 2013-10-01 09:30:00 | 2013-10-01 17:00:00 | --------------------------------------------------------- | 4 | 2013-10-02 09:00:00 | 2013-10-02 10:00:00 | --------------------------------------------------------- | 4 | 2013-10-02 10:30:00 | 2013-10-02 17:00:00 | --------------------------------------------------------- </code></pre> <p>How can this be achieved?</p>
 

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