Green's Functions: Strange manipulation in integral I've been studying Green's functions and basically I've found out the book and the teacher doing some strange manipulations in integrals. Basically it has been shown the following: if we have the following differential equation for $x\in [a,b]$
$$y''+p(x)y'+q(x)y=f(x)$$
With some boundary conditions then we can find it's solution by substituting $f(x)=\delta(x-\xi)$ which will yield a solution $G(x,\xi)$ of the following form:
$$G(x,\xi)=\begin{cases}c_1y_1(x)+c_2y_2(x), & x<\xi \\ d_1y_1(x) + d_2y_2(x), & x>\xi\end{cases}$$
Where both $y_1$ and $y_2$ are linearly independent solutions of the homegenous equation. Then with suitable conditions on $G$ we can find $c_i$ and $d_i$. That's fine, I understand perfectly well this derivation, why $G$ works and how to find it.
My doubt is that then it is said that for a general $f$ the solution $y$ is:
$$y(x)=\int_a^b f(\xi) G(x,\xi) d\xi$$
But this integral turns to be complicated. The reason is that $G$ is different for $x<\xi$ and for $x>\xi$, but $\xi$ varies over all $[a,b]$ so I don't know how to do this. I mean, if I suppose $x < \xi$, since $\xi$ runs all over $[a,b]$ it will pick places where $x > \xi$.
The teacher then turned this integral into
$$y(x) = \int_a^\xi f(\xi)G(x,\xi)d\xi + \int_\xi^b f(\xi) G(x,\xi)d\xi$$
But this seems nonsense. The variable $\xi$ is the free variable that runs from $a$ to $b$ it doesn't make sense to turn it into a bound for the integral. Also, there's another point: I tried to work formally with this, but then the solution $y$ depends on $\xi$.
So, how this kind of integral is manipulated correctly?

As pointed out by commenters, the intended formula was $$y(x) = \int_a^x f(\xi)G(x,\xi)d\xi + \int_x^b f(\xi) G(x,\xi)d\xi$$

As an aside, I find it more convenient to write $G$ using Heaviside function: 
$$G(x,\xi)= c_1y_1(x)+c_2y_2(x) +( b_1y_1(x) + b_2y_2(x))H ( x-\xi)$$
The advantage is that this decouples the problem of finding the  coefficients. Namely, $b_1,b_2$ are determined by the desired singularity at $x=\xi$. Once they are found, one can solve for $c_1,c_2$ from the boundary conditions.
