This script has exited at line 92 with the following error: Column 'RANK' in order clause is ambiguous