Query: All employee with sum of salary > 500
After playing around with this some more, I came up with this query:

SELECT ssn, name, salary FROM (
  SELECT ssn, name, salary, (@total:=@total+salary) as total
  FROM worker, (select @total:=0) t
  ORDER BY salary ASC
) as foo
WHERE (total-salary) &lt;=500


This seems to do what you want on this limited data, but could be very slow on large datasets.