-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeedbuilder.sql
More file actions
28 lines (26 loc) · 1005 Bytes
/
Copy pathfeedbuilder.sql
File metadata and controls
28 lines (26 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SELECT bib_view.record_num FROM
(SELECT DISTINCT
bib_record.id
--fund_master.code
FROM
sierra_view.bib_record,
sierra_view.item_record,
sierra_view.order_record,
sierra_view.bib_record_item_record_link,
sierra_view.bib_record_order_record_link,
sierra_view.order_record_cmf,
sierra_view.fund_master
WHERE
bib_record.id = bib_record_item_record_link.bib_record_id
AND bib_record.id = bib_record_order_record_link.bib_record_id
AND item_record.id = bib_record_item_record_link.item_record_id
AND order_record.id = bib_record_order_record_link.order_record_id
AND order_record_cmf.order_record_id = order_record.id
AND bib_record.bcode3 = '-'
AND CAST (order_record_cmf.fund_code AS INTEGER) = fund_master.code_num
AND (fund_master.code = 'engr1' or fund_master.code = 'sthay')
AND bib_record.cataloging_date_gmt > current_timestamp - (30 * interval '1 day')
) AS bibrecid, sierra_view.bib_view
WHERE bib_view.id = bibrecid.id
ORDER BY record_num DESC
--LIMIT 200