Jump to content

Newest Date


The Little Guy

Recommended Posts

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
https://forums.phpfreaks.com/topic/130938-newest-date/#findComment-679738
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
https://forums.phpfreaks.com/topic/130938-newest-date/#findComment-679769
Share on other sites

I just want to grab what the last post date of the item is, such as in the forum...

 

"on Today at 12:24:24 PM"

 

That shows the date and time of the last post or topic. I need to grab that date.

 

I have tried a MAX, and it just displays as "1"... maybe I was doing it wrong.

Link to comment
https://forums.phpfreaks.com/topic/130938-newest-date/#findComment-679775
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.