SELECT DISTINCT "Order No" AS "Order No",
	"Type" AS "Type",
	"No" AS "No",
	"Last Name" AS "Last Name",
	"Entry No" AS "Entry No",
	"Qty Evaluated" AS "Qty Evaluated",
	RANK() OVER (
		PARTITION BY "Order No" ORDER BY "Qty Evaluated"
		) AS "RANG  (  Qty Evaluated  )"
FROM (
	SELECT T1."Order No_" AS "Order No",
		T1."Type" AS "Type",
		T1."No_" AS "No",
		T2."Last Name" AS "Last Name",
		T1."Entry No_" AS "Entry No",
		(convert(FLOAT, T1."Qty_ Evaluated")) AS "Qty Evaluated",
		XRANK(((convert(FLOAT, T1."Qty_ Evaluated"))) FOR T1."Order No_") AS c8
	FROM (
		"ARI"."import"."Service Ledger Entry" T1 LEFT JOIN "ARI"."import"."Employee" T2 ON T2."No_" = T1."No_"
		)
	WHERE (
			(
				(
					((- 1 * datediff(day, (getdate()), T1."Posting Date")) <= 120)
					AND (T1."Order No_" LIKE 'W%')
					)
				AND (T1."Type" = 2)
				)
			AND (((convert(FLOAT, T1."Qty_ Evaluated"))) <> 0)
			)
	) D1
WHERE (c8 = 1)
	-- order by "Order No" asc
