Fix Where before Join statement