Jump to content

Newest Date


The Little Guy

Recommended Posts

you cant have a largest timestamp, and its not ordering all the timestamps, its showing them all from your table ordering by timestamp descending (e.g. latest date first) then limiting itself to only get 1 result so it only ever gets 1 result as you put it the largest one.

Link to comment
Share on other sites

Then how would yo integrade it into this query? It needs to be the newest from either the table: topics or replies.

 

SELECT c.`category`,
c.id AS 'cid',
b.order,
b.`title` AS 'title',
b.`description` AS 'description',
b.id 'bid',
COUNT(t.id) AS 'topicCount',
COUNT(r.id) AS 'postCount'
FROM `boards` b
LEFT JOIN topics t ON(t.`boardID` = b.id)
LEFT JOIN replies r ON(r.`topic_id` = t.id)
LEFT JOIN categories c ON(b.`group` = c.id)
GROUP BY b.`id`
ORDER BY
c.`order` ASC, b.`group` ASC, c.`order` ASC

Link to comment
Share on other sites

TLG, what are you trying to accomplish in relation to the forum you're building?

 

Is this to pull the title of the last post to display in the "Last post info" area?

 

Also, it would help me if you gave me a data dump (not the schema, but actual data export as well) and tell me what columns to display and what conditions). .. mainly data to work with.

 

I have a feeling it will be an additional column in that query that's something like: select max(post_date) from replies where topic id in topic.id or w/e

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.