sql - Counting Occurrences in MS Access -


i trying return list of rooms occupant or investigator associated with. want include people associated more 1 room.

i tried following query

select [occupant], [investigator], [room number], [room subuse], count([occupant]), count([investigator])     [facilities management schedule]         group [occupant], [investigator], [room number], [room subuse]             having (count([occupant]) > 1 or count([investigator]) > 1); 

which returns result enter image description here

but data enter image description here

which seems not include weibo cai or occupancy in rooms 7148-*. because count of him existing in space not greater 1, there way reformat query obtain data want?

thanks, otterman

group by , having right idea, need group room information. use having filter want:

select [room number], count([occupant]), count([investigator]) [facilities management schedule] group [room number] having (count([occupant]) > 1 or count([investigator]) > 1); 

i don't know if [room subuse] of interest. assumes occupant , investigator have null values (as opposed blanks of sort) when fields not used.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -