Created
September 15, 2014 21:13
-
-
Save pmgreen/519ce8ed009c58a472bc to your computer and use it in GitHub Desktop.
Get a random sample of n records per Voyager location
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
| /* Relates to Ex Libris' Voyager ILS. Used in Toad for Oracle Freeware and SQL Developer (not MS Access) */ | |
| SELECT * FROM ( | |
| SELECT b.BIB_ID, m.MFHD_ID, m.LOCATION_ID, ROW_NUMBER() | |
| OVER ( | |
| PARTITION BY m.LOCATION_ID ORDER BY m.LOCATION_ID | |
| ) SampleCount FROM BIB_TEXT b LEFT JOIN BIB_MFHD bm ON b.BIB_ID = bm.BIB_ID | |
| LEFT JOIN MFHD_MASTER m ON bm.MFHD_ID = m.MFHD_ID | |
| WHERE m.LOCATION_ID IN | |
| ( | |
| '1', '6', '7' | |
| )) | |
| WHERE SampleCount <= n; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment