Page 1 of 1
latest entry in multiple tables
Posted: Wed Mar 31, 2010 6:48 am
by marthaller
I've just designed a website that hosts a tri-weekly comic and blog posts by two people. On the homepage I have the latest comic, and latest post by each person. what I want to do is put the most recent one of each in order of date on the page. it's easy with the blog, as the layout is the same in each, but integrating it with the comic I"m having trouble with. can anybody help. thanks.
Re: latest entry in multiple tables
Posted: Wed Mar 31, 2010 6:50 am
by roders
If you're using a query, then normal a simple "order by [fieldnameholdingdate]" should suffice to sort each in date order.
Re: latest entry in multiple tables
Posted: Wed Mar 31, 2010 7:09 am
by marthaller
thanks or the quick reply. I have no trouble getting the entry, but when I have these three entries, there are two different formats dopending on if it's a comic of blog entry. that's what I'm trying to figure out. thanks
Re: latest entry in multiple tables
Posted: Wed Mar 31, 2010 7:50 am
by Weiry
marthaller wrote:thanks or the quick reply. I have no trouble getting the entry, but when I have these three entries, there are two different formats dopending on if it's a comic of blog entry. that's what I'm trying to figure out. thanks
What roders posted has nothing to do whether you have trouble getting the entry... its an SQL update to sort by the most recent entry by date.
Although it should read:
Code: Select all
SELECT * FROM `yourTable` ORDER BY `dateTime` DESC
Where DESC puts the most recent first.
However.. you have not indicated any sort of table structure for your comics/blog nor have you provided any code for us so that we have a bone to play with, so its slightly difficult to give you a 100% correct solution.