SELECT 
  ps.partkey, 
  sum(ps.supplycost*ps.availqty) AS value
FROM 
  "${database}"."${schema}"."${prefix}partsupp" ps,
  "${database}"."${schema}"."${prefix}supplier" s,
  "${database}"."${schema}"."${prefix}nation" n
WHERE 
  ps.suppkey = s.suppkey 
  AND s.nationkey = n.nationkey 
  AND n.name = 'GERMANY'
GROUP BY 
  ps.partkey
HAVING 
  sum(ps.supplycost*ps.availqty) > (
    SELECT 
      sum(ps.supplycost*ps.availqty) * 0.0001000000 / ${scale}
    FROM 
      "${database}"."${schema}"."${prefix}partsupp" ps,
      "${database}"."${schema}"."${prefix}supplier" s,
      "${database}"."${schema}"."${prefix}nation" n
    WHERE 
      ps.suppkey = s.suppkey 
      AND s.nationkey = n.nationkey 
      AND n.name = 'GERMANY'
  )
ORDER BY 
  value DESC
;

SELECT 
  ps.partkey, 
  sum(ps.supplycost*ps.availqty) AS value
FROM 
  "${database}"."${schema}"."${prefix}partsupp" ps,
  "${database}"."${schema}"."${prefix}supplier" s,
  "${database}"."${schema}"."${prefix}nation" n
WHERE 
  ps.suppkey = s.suppkey 
  AND s.nationkey = n.nationkey 
  AND n.name = 'GERMANY'
GROUP BY 
  ps.partkey
HAVING 
  sum(ps.supplycost*ps.availqty) > (
    SELECT 
      sum(ps.supplycost*ps.availqty) * 0.0001000000 / ${scale}
    FROM 
      "${database}"."${schema}"."${prefix}partsupp" ps,
      "${database}"."${schema}"."${prefix}supplier" s,
      "${database}"."${schema}"."${prefix}nation" n
    WHERE 
      ps.suppkey = s.suppkey 
      AND s.nationkey = n.nationkey 
      AND n.name = 'GERMANY'
  )
ORDER BY 
  value DESC, 
  -- additional column to assure results stability for larger scale factors; this is a deviation from TPC-H specification
  ps.partkey ASC
;

Add additional order by columns for tpc-h query 11
Add additional order by columns for tpc-h query 11

Query results are not stable for larger scale factors.
This change does NOT follow current tpc-h specification.
