Course modules are the resources that you have added to a course. From what you have provided I think you have only 3 resources added to a course and there are 27 sections..
if you run this query
you will get all the sections and show each course modules..
e.g. if you have 2 modules in 1 section then you will see the section multiple times.
if you have only one or no modules in a section then you will only see it once.
Hope this helps