Hello everyone please help if you can, I am trying to write a query that shows me every cell in a housing area that has 3 inmates , when I run what I have written I see cells with 2 and 3 inmates. Please advise
Thank you for helping.
select offender, facility,block,cell,bed,movein,moveout,stay
from pps_housingchanges AS H
WHERE ((Select count(*)AS Expr1
from pps_housingchanges AS H1
where (H.block = block) and (H.cell = cell))>2) and facility='THC' and moveout is null
order by block,cell
Thank you for helping.
select offender, facility,block,cell,bed,movein,moveout,stay
from pps_housingchanges AS H
WHERE ((Select count(*)AS Expr1
from pps_housingchanges AS H1
where (H.block = block) and (H.cell = cell))>2) and facility='THC' and moveout is null
order by block,cell