As per the error, remove the order by from your custom SQL.
I don't know the specific SQL tableau is generating in your case but it's likely doing something like
(YOUR CUSTOM SQL HERE)
In which case your order by is causing the problem.
There's no point ordering data before it comes into Tableau anyway. It's a waste of time.
Thanks Tom i already removed it.
Did this solve the problem?
If so, please mark the answer as correct to close the thread.