Skip to content

Instantly share code, notes, and snippets.

@DeBraid
Created August 26, 2021 19:31
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 DeBraid/f1051aa40ef0b4805179973d19a0830f to your computer and use it in GitHub Desktop.
Save DeBraid/f1051aa40ef0b4805179973d19a0830f to your computer and use it in GitHub Desktop.
PSQL: get most recent inventory given product ids
SELECT
createdon
FROM
inventory
WHERE
productid in(
SELECT
id FROM product
WHERE
verified = FALSE
AND iscannabis = TRUE
ORDER BY
createdon DESC)
AND createdon > now() - interval '4 hours';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment