My post wasn’t intended to be a criticism - I was genuinely interested to know the answer.
I work on what are considered hard CS problems and I rarely find the difficult part is knowing some data structure or algorithm, but in finding a way of translating real world problems into something that makes sense in code.
I am not sure of your study of problems but you have spoken like techno-functional user. Finding a good translation surely is a big part but then getting things correct is also required. Writing couple of joins to get the correct data is fine but getting the correct join or data type or structure is also required. The difference being running a code for couple of hours vs in couple of minutes.
I am not suggesting that the right data structure is not important, just that is not where the difficulty lies. I can solve problems that my far more CS knowledgable employees can't because I have a better understanding of the domain. My solutions are not always the most elegant, but they work (most of the time).
My point is on the elegance of a solution. As you said your solution works but that can be attributed to your domain knowledge. But the affect of your solution might be understated. We have people who write direct queries after much discussion with us. While we can't directly point them out, the queries tend to run for hours affecting other people's work and then we have to rework the whole thing all over again.