Created
November 26, 2013 23:16
-
-
Save billy-bacon/7668032 to your computer and use it in GitHub Desktop.
This file contains 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
<select id="getRemainingBorrowsForMonth" resultType="java.lang.Integer"> | |
select | |
( | |
select circsPerPatronMonth | |
from Account | |
where libraryId = (select libraryId from Patron where id=#{value}) | |
) | |
- | |
( | |
select count(*) | |
from Circ | |
where patronId=#{value} | |
date_trunc('month', borrowed) = date_trunc('month',now()) | |
and date_trunc('year', borrowed) = date_trunc('year',now()) | |
) | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment