| How to output a query subset I want to pull in the table once, and output it in several different ways |
RevoltPuppy

msg:4400542 | 3:52 pm on Dec 22, 2011 (gmt 0) | Hello, I have a question about outputting a query subset. What I would like to do is select the whole table, and then output it based on date. Right now I'm doing several different queries to select from each year, which seems somewhat inefficient. So, ideally, my output would look something like this: [Select all press release data from the table.] 2011 [Output press releases for the year 2011.] 2010 [Output press releases for the year 2010.] 2009 [Output press releases for the year 2010.]
|
Dijkgraaf

msg:4400656 | 9:20 pm on Dec 22, 2011 (gmt 0) | It sounds like you might just want to order by the field that holds the year/date of publication in descending. e.g ORDER BY publicationdate DESC Then loop through all the records selected and when the year in the data changes create the break or heading or whatever you want.
|
RevoltPuppy

msg:4400677 | 9:57 pm on Dec 22, 2011 (gmt 0) | Yes, that sounds like what I would like to do. How would I set up the loop to detect the change in the year?
|
|
|