A compound having an SGLT1 and/or SGLT2 inhibitory activitywhich is usable as an agent for the prevention or treatment ofdiabetes, postprandial hyperglycemia, impaired glucosetolerance, diabetic complications, obesity, etc. It is a1-substituted-3-(.beta.-D-glycopyranosyl) nitrogen-containingheterocyclic compound represented by the general formula (I),a prodrug thereof, or a pharmaceutically acceptable salt thereof,or a hydrate or a solvate thereof; an SGLT inhibitor containingthe same; a pharmaceutical composition containing the same anda combination pharmacy of them. In the formula, A representsan alkylene group or alkenylene group; B represents a singlebond, -O-, -S- or -NH-; C represents an optionally substitutedaryl or heteroaryl group; Q independently represents a carbonatom which a hydrogen atom or a substituent binds to, or a nitrogenatom.(see formula I)