update database
Bug fix with JOIN syntax