Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

How to output a query subset

I want to pull in the table once, and output it in several different ways



3:52 pm on Dec 22, 2011 (gmt 0)

5+ Year Member

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.]
[Output press releases for the year 2011.]
[Output press releases for the year 2010.]
[Output press releases for the year 2010.]


9:20 pm on Dec 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

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.


9:57 pm on Dec 22, 2011 (gmt 0)

5+ Year Member

Yes, that sounds like what I would like to do. How would I set up the loop to detect the change in the year?

Featured Threads

Hot Threads This Week

Hot Threads This Month