Comment 8 for bug 1236979

Revision history for this message
Liam Whalen (whalen-ld) wrote :

I did not consider that there could be multiple copies with that last statement.

Would an SQL statement like the following:

SELECT ac.record, MAX(c.create_date)
FROM asset.copy c INNER JOIN asset.call_number ac ON c.call_number = ac.id
WHERE c.circ_lib = v_circ_lib AND NOT c.deleted
GROUP BY ac.record
ORDER BY MAX(c.create_date) DESC

be any better? This should return the newest create date and record for the circ_lib in question.

I am not sure if joining is slower than returning just the list of copies and looping. But, this could be used with
LIMIT p_limit + p_offset to get the right window for each cicr_lib.