DSolve[-Sum[y[x]^nu*g[nu][x], {nu, 1, q}] + Sum[y[x]^nu*f[nu][x], {nu, 1, p}]*Derivative[1][y][x] == 0,y[x],x]