Why does all this matter? Water has a tendency to move across a membrane from a lower osmolarity to a higher osmolarity. In other words, from the dilute side to the concentrated side. The outcome is that the dilute side loses water and becomes more concentrated, and the concentrated side gains water to become more dilute, so the two sides become more similar.
In the figure below, osmolarity is 3 times higher on the right, but the red molecules are trapped over there. Instead, the water can move, so it goes TOWARDS the high-osmolarity side. That makes the left side more concentrated and the right side less concentrated.
In the figure below, there are 3 solutions (0.2 M, 0.5 M, and 0.7 M) separated by membranes.
Your job is to figure out which direction(s) water is moving:
The first thing to be careful of is to calculate the osmolarities before you start. Since MgCl2 dissociates into 3 pieces, its osmolarity is triple, i.e. 0.6 OsM. Sugar does not dissociate, so it stays at 0.5 OsM. The third solution contains both sets of solutes, so its osmolarity is 0.5 + 0.6 = 1.1 OsM.
Then remember that water goes from low to high osmolarity, from weak to concentrated solutions. You can think of it as water “trying” to equalise the concentrations. So water flows from the middle compartment to either side, since both have higher osmolarity.