A compound having an SGLT1 and/or SGLT2 inhibitory activity which is usable as an agent for the prevention or treatment of diabetes, postprandial hyperglycemia, impaired glucose tolerance, diabetic complications, obesity, etc. It is a 1-substituted-3-(β-D-glycopyranosyl) nitrogen-containing heterocyclic 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 containing the same a pharmaceutical composition containing the same and a combination pharmacy of them. In the formula, A represents an alkylene group or alkenylene group B represents a single bond, -O-, -S- or -NH- C represents an optionally substituted aryl or heteroaryl group Q independently represents a carbon atom which a hydrogen atom or a substituent binds to, or a nitrogen atom.