You had no problems creating the table 'cause of you used an alias for your sum() column -as thapush advised, while original poster didn't.