Fixed sql code for basketball to generate views