-- Before | |
SELECT "namespaces".* | |
FROM "namespaces" | |
WHERE "namespaces"."type" IN ('Group') | |
AND "namespaces"."id" = 2 | |
AND "namespaces"."type" IN ('Group') | |
AND "namespaces"."type" = 'Group' | |
ORDER BY "namespaces"."id" DESC | |
LIMIT 1; | |
-- This is really all we need to achieve the exact same result: | |
SELECT namespaces.* | |
FROM namespaces | |
WHERE namespaces.id = 2 | |
-- This is because "id" is a unique value, so if you know what ID you | |
-- are looking for you will never get a row that you didn't expect, | |
-- meaning the "type" WHEREs are completely pointless. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment