maybe I am going about this in an inefficient and overly complicated way....any suggestions on how to do this another way would be welcome either. Maybe there is a way i could do it in the query?
I think there might be a way if I get you right.
So, if you want to output your data like
12-2003
record from 12-2003
next record from 12-2003
01-2004
record from 01-2004
next record from 01-2004
next record from 01-2004
02-2004
record from 01-2004
you could run separate queries for each month, but I wouldn't recommend it.
instead, consider
- getting all records within the selected period ordered by their timestamps, and selecting month/year (separately or together, doesn't matter much.)
- when looping through them:
- - whenever you stumble across a new month/year, print the new "headline".
hope this makes sense (and I didn't misunderstand you).