Thread: An Odd Query

  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    I've been trying to figure out a query for the message board on my site, but I've yet to be able to wrap my head around it.

    Here's how it works right now. The query gets all of the topic messages within the last 7 days, and all the replies to those messages. The way it knows it's a topic is that the field "isreplyto" is set to zero. all of the replies have "isreplyto" set to the id number of the original.

    What I'd like it to do, and I can't figure this out yet, is to have it check to see if there's been replies within the last seven days, and keep the message thread alive if there is. I've thought about this one for a while, and I've yet to come up with a way to do it...

    Any help or ideas would be appreciated.

    [This message has been edited by FerretComp (edited October 25, 2000).]
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Rep Power
    make a table like this:
    ThreadID <--- 1st messageid

    then use a query like this:

    SELECT ThreadID WHERE Date < (NOW()-(7*86400)) GROUP BY ThreadID

    All the resulting threads can be deleted

    i think this is the easest solution

    Greetings lewi

Similar Threads

  1. odd recordset problem after sql query
    By unclefu in forum ASP Programming
    Replies: 5
    Last Post: February 5th, 2004, 04:58 PM
  2. query syntax error
    By collegebloke in forum MS SQL Development
    Replies: 1
    Last Post: January 19th, 2004, 04:08 PM
  3. Overwriting mysql query with the query results
    By onerandomday in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2004, 04:45 AM
  4. Syntax error in INSERT INTO query
    By Lee Miles in forum Visual Basic Programming
    Replies: 6
    Last Post: December 19th, 2003, 07:37 AM
  5. nested query and MySQL query
    By lucipher in forum MySQL Help
    Replies: 1
    Last Post: November 19th, 2003, 10:49 AM

IMN logo majestic logo threadwatch logo seochat tools logo