Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL Move Table Contents To a Single Cell in Another Table
    primarykey
    data
    text
    <p>Okay, so I have two tables. Lets call them <em>test2</em> and <em>test2history</em>.</p> <p><strong>test2 looks like this:</strong> <a href="http://gyazo.com/28e89c95ff88b55d877fd8c91d627e0a.png" rel="nofollow noreferrer">MySQL table test2 http://gyazo.com/28e89c95ff88b55d877fd8c91d627e0a.png</a></p> <p><strong>test2history looks like this:</strong> <img src="https://i.stack.imgur.com/842Li.png" alt="MySQL table test2history"></p> <p>I need to pull multiple cells from table test2 and make them go into one single cell in test2history. The week column from test2 would be set to the value of week in test2history.</p> <p>The day column from test2 translates to:</p> <ul> <li>0 = Not Set</li> <li>1 = Monday</li> <li>2 = Tuesday</li> <li>3 = Wednesday</li> <li>4 = Thursday</li> <li>5 = Friday</li> </ul> <p>On the site that I am working on, when submit is clicked it should pull all cell data from test2 where week is the $_GET['week'] in the URL. Which is easy, I have that. But then, it needs to search the rows that it found and then put the 'map' values whose 'day' value are the same into the corresponding weekday in test2history. Let me stop there because I know this is confusing the way I am explaining it, let me make you a visual:</p> <p><strong>This is how I need it to work:</strong> <img src="https://i.stack.imgur.com/P1dYg.png" alt="enter image description here"></p> <p>The 'total' column in test2history should be set as the sum of the cards from test2 that had that same week number. Which I can do that myself, I just wanted to make sure you understand what is happening.</p> <p>I have read up on some group_concat() which seems like what I need to be using but I just couldn't find a good explanation that related to what I need it to do. That may not even be what I need.</p> <p>My query I struggled to write isn't correct in any way shape or form but I tried and I have no idea how go about this one, hopefully one of you guys do. Thanks for your help.</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.
    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