incorporate quality into initial MR map
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 16 Jul 2006 19:56:55 +0000 (19:56 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 16 Jul 2006 19:56:55 +0000 (19:56 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5026 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/src/extras/import/quick_metarecord_map.sql

index 96202e0..d8cd56a 100644 (file)
@@ -6,10 +6,11 @@ TRUNCATE metabib.metarecord;
 TRUNCATE metabib.metarecord_source_map;
 
 INSERT INTO metabib.metarecord (fingerprint,master_record)
-       SELECT  fingerprint,max(id)
-         FROM  biblio.record_entry
-         WHERE fingerprint IS NOT NULL
-         GROUP BY 1;
+       SELECT  fingerprint,id
+         FROM  (SELECT DISTINCT ON (fingerprint)
+                       fingerprint, id, quality
+                 FROM  biblio.record_entry
+                 ORDER BY fingerprint, quality desc);
 
 INSERT INTO metabib.metarecord_source_map (metarecord,source)
        SELECT  m.id, b.id