Log in

View Full Version : Repeating region limited by date



marynorn
01-10-2008, 11:19 AM
I have an html table row set as a repeating region, showing data in date order over five years. It works very well, however, I don't really need the whole five years worth of data. I know there's a really simple way to limit the data retrieved from the database, but I'm a total noob at this.

Edited to add: It has to be limited by date, rather than number of repeats, as there can be anywhere from 1 record to 50 in a year

james438
01-14-2008, 08:06 AM
Sounds like this is more of a MySQL problem. It sounds like what you are looking for is something along the lines of
SELECT * FROM table WHERE date >= 2005 ORDER BY column DESC LIMIT startnumber, numberofrows In this case the column would be the date assuming that you have a date column in your database. You can also use asc instead of desc where asc = ascending order. After LIMIT you can use a single number to get say 13 results.

Either way, play around with it and have fun :)

marynorn
01-14-2008, 12:47 PM
Thanks :)

I kind of futzed about with it, and checked out some similar stuff I did before Christmas knocked off 15 IQ points and a good chunk of my memory, and the following seems to work:

FROM events WHERE eventDate > DATE_SUB(CURRENT_TIMESTAMP,INTERVAL 12 MONTH) ORDER BY eventDate ASC