Skip to content

Instantly share code, notes, and snippets.

@Mr--John-Doe
Created November 24, 2021 17:46
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 Mr--John-Doe/95939acc0207dc77f4bfdb5bb77a91e0 to your computer and use it in GitHub Desktop.
Save Mr--John-Doe/95939acc0207dc77f4bfdb5bb77a91e0 to your computer and use it in GitHub Desktop.
How To Do For Loops in SQL
FOR p_date in DATE_LIST:
INSERT INTO result
SELECT p_date, ...
FROM ... JOIN ...
WHERE dt between trunc('month', p_date) and p_date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment