Hi all,
I trayed to create a function to solve the problem that i posted in (chart TOP 10 Trouble) http://asprunner.com/forums/topic/25500-chart-top-10-trouble/ , but now I have another problem.
First step: New function:

call function:

Result its OK.

But now the problem its that

and phpRunner9.6 (i cant update to 9.8...)
the program modifies the name of the table and does not modify its content.
And the Query changed:
SELECT FROM dbo.get_pareto('2018-04-16 00:00:00.000', '2018-04-22 00:00:00.000', 100)
order by FailRatio desc
to
SELECT TOP 1 FROM [dbo].[get_pareto][('2018-04-16 00:00:00.000', '2018-04-22 00:00:00.000', 100)]
order by FailRatio desc

Do you know what the reason may be?