I have a table which contains X and Y locations. I want to display all of them and next to each I would like to display the information from another table where it correlates.
This code gives me exactly what I need from the second table:
$result = mysql_query(“SELECT *,SUM(weight) FROM collection WHERE timestamp >= ‘2014-08-12 06:00:00’ AND timestamp <= ‘2014-08-13 05:59:00’ GROUP BY X, Y”);
X1.5 Y25.5 37
X1.5 Y25.6 247
X2 Y21 65
Where the first table contains every XY location and the second table only shows the totals of the XY locations that have been populated.
When I am done, it should look like this:
X Y Weight
X1 Y30
X1.5 Y25.5 37
X1.5 Y25.6 247
X2 Y15
X2 Y21 65
I think I need to JOIN the tables but I don’t know how to combine them to get what I need.