one millstone can do the work of 4 querns with much less manpower.
I don't know how to explain it properly, but the most basic setup would be starting with a millstone at the bottom, build a vertical axle on top and then the windmill above it. A little more complex would be to make a gearbox with a vertical axle and the windmill and connect one or more millstones through horizontal axles.
You need to start the construction from the bottom up usually, as all the parts need to rest on something that supports them. You also need to make sure there are holes in the ceilings so axles can pass through instead of standing on the floor.
You can also connect levers to gearboxes to turn things off. However, an 'off' gearbox won't support axles or anything above it, so keep that in mind when using them, and do use them: Always make sure that, whatever fantastic thing you made that can not possibly go wrong, you can turn it off when something does go wrong, or you want to expand it, or a goblin got lost among the machinery and you need to have it killed. This goes doubly so if you're also using water or magma in the contraption.
Windmills have some issues though. The center tile needs to be open to the sky or it stops working, which basically means you got a hole in your defences against any flying building destroyers like Titans. You also can't stack them and making a windmill park is a lot of effort for little gain. At some point you'll be losing too much energy in axles and gears. Which concerns another issue. A windmill produces 0, 20 or 40 power depending on your location, which isn't much, almost nothing or really nothing and you don't know what it'll be untill you try.
Waterwheels are more efficient. First of all, it produces a steady dependable 100 energy. It can be constructed completely indoors with only some planning required and only needs horizontal support, so gear-axle-wheel combinations can easily be switched off without the whole thing collapsing.
A waterwheel only needs moving water, it doesn't matter which way it is moving or if it is actually in a technical sense moving or just sloshing around.water of 4/7, 4/7 and 5/7 with have the 5 moving around continuously, which is enough to produce power.
You need to plan where it goes, because the water will be on the z-level below, you need to make a sort of cistern there.