Last active
September 23, 2020 11:02
-
-
Save vbilopav/d7ac47003d4a3d21365c210b0960c25e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
g.code | |
from ( | |
select generate_series as code from generate_series(1000, 9999) | |
) g | |
left outer join tbl t on g.code = t.id | |
where | |
t.id is null | |
order by | |
random() limit 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment