Created
June 2, 2009 00:16
-
-
Save jmhodges/121902 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| SELECT count(DISTINCT "searches".id) AS count_distinct_searches_all | |
| FROM "searches" | |
| LEFT OUTER JOIN "queries" ON "queries".id = "searches".query_id | |
| INNER JOIN "tasks" ON tasks.search_id = searches.id | |
| WHERE | |
| ( | |
| ( | |
| ( | |
| ( | |
| NOT exists( | |
| SELECT search_results.id FROM search_result_ownerships, search_results | |
| WHERE searches.id = search_results.search_id | |
| AND search_result_ownerships.search_result_id = search_results.id | |
| AND search_result_ownerships.search_engine_id = 7 | |
| ) | |
| ) | |
| AND (tasks.job_id IS NOT NULL) | |
| ) | |
| AND ("searches".project_id = 20) | |
| ) | |
| AND ("searches".project_id = 20) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment