Fixed the sql, hopefully.