Skip to content

Instantly share code, notes, and snippets.

@igeligel
Last active June 17, 2019 10:34
Show Gist options
  • Save igeligel/da7de5eeec77821eed7371fc62910d53 to your computer and use it in GitHub Desktop.
Save igeligel/da7de5eeec77821eed7371fc62910d53 to your computer and use it in GitHub Desktop.
SELECT SUM(price),
CASE
WHEN name = ANY (ARRAY ['Airbus A333-300', 'Airbus A380-800']) THEN 'airplane'
WHEN name = ANY (ARRAY ['Volkswagen Golf', 'Porsche Cayenne']) THEN 'car'
ELSE null
END AS type
FROM vehicles
GROUP BY vehicle_type;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment