dimanche 27 septembre 2015

Order all record by result of divison of count of rows and count of rows with where condition

Here's the table I am working with below.

enter image description here

What I am trying to do is to get the total count of rows for each emp_id as total_count, then get the total count of rows for each emp_id where tos >0 as total_eligible, and then order them by total_eligible/total_count.

Here's the fiddle I am working with.

Aucun commentaire:

Enregistrer un commentaire