[thesite] friday is a good day..

jeff jeff at members.evolt.org
Fri May 18 15:58:34 CDT 2001


rudy,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: rudy
:
: sorry for the long post just now
:
: i got so carried away with the sql, i forgot to ask the most fundamental
: question --
:
: the nested query contains
:
:   WHERE replies.datemod > ''
:
: that cannot be right, can it?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

no, that's not right -- with an explanation.

that query was obviously generated without the user being logged in (hence
no lastlogin value).  however, when the user is logged in it will do the
comparison against an actual date value.

see my other response to you to see a suggestion about how i'd handle that.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: i thought content.replies is supposed to hold
: the number of comments on the article
:
: so what is the nested subquery for??
:
: surely it's not the number of recent replies,
: is it?
:
: heck, that's not what the datemod field is...
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

in that table the datemod field stores when a comment was inserted.  so,
we're querying for all comments for a given article where the datemod is
greater than last login of the current logged in user.  fwiw, the full
subselect looks like this:

 (SELECT Count(*)
    FROM replies
   WHERE contentid = content.contentid
     AND datemod > '#DateFormat(session.user.lastlogin)#'
 ) AS newcomments

make more sense?

thanks,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org





More information about the thesite mailing list