edit sql quuerry with get params u and d