Fixing up the sql to work my mysql