Skip to content

Instantly share code, notes, and snippets.

@pcdinh
Created July 17, 2009 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcdinh/148848 to your computer and use it in GitHub Desktop.
Save pcdinh/148848 to your computer and use it in GitHub Desktop.
SELECT
MAX(CASE
WHEN checked_status = 0 THEN doc_count
ELSE 0
END) file_not_existed,
MAX(CASE
WHEN checked_status = 1 THEN doc_count
ELSE 0
END) file_existed,
MAX(CASE
WHEN checked_status = 5 THEN doc_count
ELSE 0
END) wvb_number_not_found,
MAX(CASE
WHEN checked_status = 7 THEN doc_count
ELSE 0
END) AS unable_rename,
MAX(CASE
WHEN checked_status = 8 THEN doc_count
ELSE 0
END) invalid_file_extension,
MAX(CASE checked_status
WHEN -1 THEN doc_count
ELSE 0
END) not_checked
FROM (
SELECT
checked_status,
COUNT(checked_status) doc_count
FROM (SELECT
NVL(checked_status, -1) checked_status -- script does not check newly added records
FROM wvb_document)
GROUP BY checked_status
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment