Reputation: 1
I have two columns of data and I need to select only the rows where the percentage is above a certain percentage of another (say 80%). So in the table below the only records selected would be rows 2 and 4 in the table pic. I also need to avoid any rows where either value is = 0.
I have tried using ratio_to_report but just can't seem to make it work. Any help appreciated.
Upvotes: 0
Views: 175
Reputation: 51
select * from job_hours where Hours/"Est Hours">0.8 and "Est Hours"<>0
Upvotes: 0
Reputation: 880
The percentage is a ratio of two values per 100. So the formula would be percentage=Hours/Est Hours x 100. Conversely 80% would be a ratio of 0.8. So your where condition could be Hours/"Est Hours">0.8. Please note that since your column name has a space it has to be enclosed in double quotes.
select * from table where Hours/"Est Hours">0.8
Upvotes: 1