1
我知道別名使用別名不工作,但無法弄清楚得到得到預期的結果「和count_of_circs = circ_limit」SQL在WHERE子句
select libraryid,
patronid,
count(circ.id) as count_of_circs,
(
select account.circsperpatronmonth
from account
where circ.libraryid = account.libraryid
) as circ_limit
from circ
where borrowed >= '2014-04-01'
and borrowed < '2014-04-19'
and count_of_circs = circ_limit
group by patronid,libraryid
這是什麼數據庫? – OldProgrammer
你能解釋你的桌子嗎? – HaMeD