Skip to content

Instantly share code, notes, and snippets.

@adngdb
Created August 9, 2017 14:52
Show Gist options
  • Select an option

  • Save adngdb/ac00ea34361a463a827241c6e5050edc to your computer and use it in GitHub Desktop.

Select an option

Save adngdb/ac00ea34361a463a827241c6e5050edc to your computer and use it in GitHub Desktop.
SELECT COUNT(id)
FROM base_translation
WHERE approved = FALSE
AND fuzzy = FALSE
AND date < (
SELECT GREATEST(bt.date, bt.approved_date)
FROM base_translation bt
WHERE bt.approved = TRUE
AND bt.entity_id = base_translation.entity_id
AND bt.locale_id = base_translation.locale_id
ORDER BY bt.approved_date DESC, bt.date DESC
LIMIT 1
);
-- 153952
SELECT COUNT(id)
FROM base_translation
WHERE approved = FALSE
AND fuzzy = FALSE
AND date < (
SELECT GREATEST(bt.date, bt.approved_date)
FROM base_translation bt
WHERE bt.approved = TRUE
AND bt.entity_id = base_translation.entity_id
AND bt.locale_id = base_translation.locale_id
AND bt.plural_form = base_translation.plural_form
);
-- 1954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment