Old 04-07-2008, 10:39   #1 (permalink)
barryk
Registered User
 
Join Date: Jul 2008
Posts: 1
Mysql query

Just wondering of anybody can lend me a hand with the query below, as you can see it is for a forum and it is getting the post title and user who posted it.

What i am trying to do is order the posts in the thread by the last post to that thread but instead it is getting ordered by first post in the thread. All posts live in the forum_posts table with a unique id, threadid and cat. Threadid is the id number of that thread's first post. cat id is the id number of the cat that thread belongs to.

I think i all most have it (may involve another join?) but i cannot quite get it to do it

Code:
SELECT forum_posts.title, forum_posts.id, users.username FROM forum_posts INNER JOIN mp.users ON (forum_posts.who=users.id) WHERE (forum_posts.id = forum_posts.threadid) AND (forum_posts.cat = 24) ORDER BY `postdate` DESC
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8