SQL correction

Massive speed enhancement