Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > need help with a select and order problem

Reply
Thread Tools

need help with a select and order problem

 
 
Dan
Guest
Posts: n/a
 
      04-20-2004
I have a forum running on ASP that allows people to set how many days
they want to see of messages (cutoffdate). The board is set up with
the following select statement - "SELECT * FROM Forum WHERE
DateCreated > cutoffdate ORDER BY ThreadID, FieldSortCode" The
threadid is a sequential number for new threads and the fieldsortcode
is sequential for each reply to the parent thread. For example, a new
thread would get a threadid of 8040 and a sortcode of 8040. A reply
to this thread would get a threadid of 8040 and a sortcode of 8040.1.
It gets a bit more complicated when there's a reply to a reply...but I
think this gives an idea on how the messages are set up.

If someone comes along and replys to a post beyond the person's
cutoffdate, then the reply shows up at the very bottom of the message
board as it should based on threadid and sortcode. Is it possible to
construct a select statement that would order a message with a parent
message beyond the cutoff date at the top of the list. So when
someone replys to a message that is beyond the cutoff date, it will
show up at the top and not at the bottom? I'm thinking I might have
to order by date and sort code and not by sort code alone? Or am I
dreaming?

Dan
 
Reply With Quote
 
 
 
 
Chris Hohmann
Guest
Posts: n/a
 
      04-20-2004
"Dan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I have a forum running on ASP that allows people to set how many days
> they want to see of messages (cutoffdate). The board is set up with
> the following select statement - "SELECT * FROM Forum WHERE
> DateCreated > cutoffdate ORDER BY ThreadID, FieldSortCode" The
> threadid is a sequential number for new threads and the fieldsortcode
> is sequential for each reply to the parent thread. For example, a new
> thread would get a threadid of 8040 and a sortcode of 8040. A reply
> to this thread would get a threadid of 8040 and a sortcode of 8040.1.
> It gets a bit more complicated when there's a reply to a reply...but I
> think this gives an idea on how the messages are set up.
>
> If someone comes along and replys to a post beyond the person's
> cutoffdate, then the reply shows up at the very bottom of the message
> board as it should based on threadid and sortcode. Is it possible to
> construct a select statement that would order a message with a parent
> message beyond the cutoff date at the top of the list. So when
> someone replys to a message that is beyond the cutoff date, it will
> show up at the top and not at the bottom? I'm thinking I might have
> to order by date and sort code and not by sort code alone? Or am I
> dreaming?
>
> Dan


Please provide the following:
1. Database
2. Version
3. Data Definition Language (CREATE TABLE ...)
4. Sample Data
5. Desired output

-Chris Hohmann


 
Reply With Quote
 
 
 
 
roger
Guest
Posts: n/a
 
      04-21-2004
"Dan" wrote

> If someone comes along and replys to a post beyond the person's
> cutoffdate, then the reply shows up at the very bottom of the message
> board as it should based on threadid and sortcode. Is it possible to
> construct a select statement that would order a message with a parent
> message beyond the cutoff date at the top of the list.


Does this work?

SELECT * FROM Forum WHERE
DateCreated > cutoffdate ORDER BY (DateCreated > cutoffdate), ThreadID,
FieldSortCode

Of course, I'm only guessing about the following -

True = -1
False = 0
That the syntax works on your version of SQL


--
roger


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort order Problem with datatable.select method emailtonitin@gmail.com ASP .Net 3 03-24-2005 08:07 AM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM
Traversion order cf. output order in XSL Soren Kuula XML 2 02-01-2004 09:10 AM
In which order are files looked for when loaded/requierd - and what'sthe order of suffixes? Stephan Kämper Ruby 2 01-18-2004 02:07 PM
Select top 40 * from and Order By Bryan Harrington ASP General 4 12-16-2003 10:23 PM



Advertisments