extend_reporter.copy_count_per_org (view)
|
This is a database view, not a base table. It has no triggers, indexes, or FK constraints of its own. Querying this view may be more efficient than joining the underlying tables directly. |
Columns
| Column | Type | Nullable | Notes |
|---|---|---|---|
bibid |
|
Yes |
|
circ_lib |
|
Yes |
|
owning_lib |
|
Yes |
|
last_edit_time |
|
Yes |
|
has_only_deleted_copies |
|
Yes |
|
deleted_count |
|
Yes |
|
visible_count |
|
Yes |
|
total_count |
|
Yes |
View Definition
SELECT acn.record AS bibid,
ac.circ_lib,
acn.owning_lib,
max(ac.edit_date) AS last_edit_time,
min(ac.deleted::integer) AS has_only_deleted_copies,
count(
CASE
WHEN ac.deleted THEN ac.id
ELSE NULL::bigint
END) AS deleted_count,
count(
CASE
WHEN NOT ac.deleted THEN ac.id
ELSE NULL::bigint
END) AS visible_count,
count(*) AS total_count
FROM asset.call_number acn,
asset.copy ac
WHERE ac.call_number = acn.id
GROUP BY acn.record, acn.owning_lib, ac.circ_lib;