Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:52:19+00:00 2026-06-03T06:52:19+00:00

http://www.vidyasocks.com/requests.php I want it so when I post in a thread it will bump

  • 0

http://www.vidyasocks.com/requests.php

I want it so when I post in a thread it will bump that thread to the top.

This is what I currently have for the page"SELECT * from forum ORDER BY id DESC LIMIT 12";

The database has thread with an id(pk) and replies with a id(pk) and a thread_id(fk)

What do I do? Some kind of inner join I’d assume?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:52:21+00:00Added an answer on June 3, 2026 at 6:52 am

    Do you have a date/timestamp for when threads and replies are inserted? You can’t just order based on reply ID because there are threads without any reply and it isn’t possible to correlate thread_id order with the reply id order.

    If I have the right idea for your table structure you’d be doing something like this given some timestamps:

     SELECT DISTINCT forum.* FROM forum 
          LEFT JOIN replies on
              forum.id = replies.thread_id
      ORDER BY coalesce(replies.reply_timestamp, forum.thread_timestamp) DESC
        LIMIT 12
    

    The coalesce would return replies.reply_timestamp if a reply exists otherwise the forum.thread_timestamp would be used.

    edit: added DISTINCT based on Ami’s comment

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://pastebin.com/bnMaxjep http://www.vidyasocks.com/index.php See the ticker at the bottom, I want to update that so
http://www.chuckecheese.com/rotator.php?cheese=4&id=1 I want to take out the id, leaving the cheese to stand alone.
http://www.red-gate.com/products/dotnet-development/smartassembly/ Is there a program like smartassembly for C++ that will remove all unneeded
http://www.codeplex.com/IIRF/Thread/List.aspx My webhost installed IIRF for me and I am convinced that they did
http://www.vidyasocks.com/forums.php?id=1&id=1 as you can see at the bottom I am using hash as a
http://www.vidyasocks.com/forums.php?id=16&id=16 As you can see here I am having a text overflow issues. What
http://www.roguevalleyroses.com/rose_list.php?search_id=&class=&height=&growth=&color=&bloom_size=&bloom_type=&shade=&fragrance=&disease=&rebloom=&thorns=&zone=&hybridizer=Ashdown%20Roses&date_range=&text=&view=&show=&page=4 This is the page. The code that queries the results is here: http://pastebin.com/d51bfa53f
http://www.ddrewdesign.com/portfolio/ I've run that on three different VMs and my brother's regular (and very
http://www.ericmmartin.com/projects/simplemodal/ There's two examples near the bottom of the page that show how to
http://www.sitepoint.com/build-to-do-list-30-minutes/ So I was doing this (http://www.sitepoint.com/build-to-do-list-30-minutes/) tutorial and everyting went OK. but now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.