I attach simple database name school I want query to count 1- All namedevice = computer by devicekind = p4 in lab A to school 2- All namedevice=datashow in school in all labs in school