Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL Update one table, but use data from two other tables as part of the update
    text
    copied!<p>I wish to update one table in my database, the data is from a php POST. (It is a page where multiple edits on rows can take place at once, then it processes them all at once after) and i want it so for each "row" or "loop", it builds a single query that can update all the rows at once.</p> <p>What i want to do, is in the query, select data from two other tables. E.g</p> <pre><code>Posted data: - Task = "Check current Sponsors" - User Assigned = "Dan" - Start Meeting = "Mar 1st" - Meetings Required = 2 </code></pre> <p>And for User Assigned, i want it to basically do this query:</p> <blockquote> <p>SELECT <code>id</code> FROM <code>team</code> WHERE <code>fullname</code> LIKE 'Dan'</p> </blockquote> <p>And for the start meeting, i want it to do this query:</p> <blockquote> <p>SELECT <code>id</code> FROM <code>meetings</code> WHERE <code>starttime</code>='".strtotime("Mar 1st")."'</p> </blockquote> <p>-- strtotime() makes a unix timestamp from a string.</p> <p>but i want it to do that for each "task" that gets submitted. (It is queued up via javascript and it sends them all into the same post request)</p> <p>Anyone have any ideas on how to do this? Thanks in advance</p> <p>Table Structures:</p> <p>Tasks:</p> <pre><code>id | startmid | length | task | uid | completed 1 | 2 | 1 | Check Sponsors | 1 | 0 </code></pre> <p>Meetings: (Joined by startmid)</p> <pre><code>id | maintask | starttime | endtime 1 | Sponsors | 1330007400 | 1330012800 </code></pre> <p>Team: (Joined by uid)</p> <pre><code>id | fullname | position | class | hidden 1 | Team | All Members | black | 0 2 | Dan S | Team Manager | green | 0 </code></pre>
 

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