SELECT name, MAX(weight)
FROM product
WHERE weight IS NOT NULL
ORDER BY weight DESC, ProductID ASC
LIMIT 10
;
SELECT 'Last_query_cost' AS [Variable_name], dbo.ufnGetQueryCost('SELECT name, MAX(weight)
FROM product
WHERE weight IS NOT NULL
ORDER BY weight DESC, ProductID ASC
LIMIT 10
') AS [Value];