So I have to generate a report that shows data over several years broken out by month. Each contract in the database has data somewhere in those years, but may have records spread out randomly (like 2-3 months in one year, then 1 month in the next year).
Data:
Contract | 01/2009 | 02/ 2009 | 03/2009
ABCD | 0 | 500 | 200
Shitty example, but in the above the database only holds records for Feb and March. My previous code was running a query based on the month and year in my loop but that's obvious inefficient.
So my initial thought was to run the query for a single contract and dumping it into an array, putting the key of the array as the month and year... but then I have multiple values to look at. So I was going to create a bunch of objects containing the data... but then how do I search a bunch of objects to see if one exists for the year and month I need to output? I feel like I will end up with an array of objects.
Did that make any sense?