Years ago I came across a Knapsack problem solution written in Oracle SQL, that I adapted to Daily Fantasy Golf.
Here's the source: https://aprogrammerwrites.eu/?p=878
Cheers