Skip to content

Instantly share code, notes, and snippets.

@kiddojazz
Created June 27, 2023 08:16
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 kiddojazz/ef4c65770ca71120a876c51d8dbbaf86 to your computer and use it in GitHub Desktop.
Save kiddojazz/ef4c65770ca71120a876c51d8dbbaf86 to your computer and use it in GitHub Desktop.
select customer_id, state_, profit_total,
max(profit_total) over( Partition by state_) as Max_profit,
min(profit_total) over( Partition by state_) as Min_profit
from customer_order_window;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment