Created
February 8, 2018 20:10
-
-
Save wbotelhos/f0378fbeab67ca9fe7c53b65734c9603 to your computer and use it in GitHub Desktop.
Rating Debug Queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total_count = "SELECT COUNT(DISTINCT resource_id) FROM reviews WHERE resource_type = 'Article' AND scopeable_type is NULL" | |
distinct_count = "SELECT COUNT(1) FROM reviews WHERE resource_type = 'Article' AND scopeable_type is NULL" | |
Review.find_by_sql("#{distinct_count}").as_json | |
Review.find_by_sql("#{total_count}").as_json | |
Review.find_by_sql("SELECT (CAST(0 AS DECIMAL(17, 14)) / 0) count_avg").as_json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment