Damn you Group by, DAMN YOU
So I was playing around with some SQL today trying to work out a few things logically for the front end of the site along with some possible new functionality as well and ran into a few issues. I managed to get around these by introducing some where in's into my sql clauses then also some counts from other tables into the main select feeding it an id from the actual select.
I was feeling good that I had this all working but had column naming issues so i looked at trying to give them a different alias but keep running into issues. Looking up online i discover that I could have done what I was doing by using the group by clause.... f**k I keep forgetting about this stupidly. Ok it took a lot longer to get all 4 pieces of sql working the same way with the group by thanks to some odd returns of data but the code looks and works so much better.