| Patrice 2006-02-20, 6:55 pm |
| Have you tried COUNT(*) instead of COUNT(Date) as mentioned in the subject
line ? It looks like I don't find this attempt in the message body...
--
Patrice
"Thomas" <nospam@devdex.com> a écrit dans le message de
news:%23IvV$YrMGHA.500@TK2MSFTNGP15.phx.gbl...
> Hi!
>
> Iīm a newbie with this and Iīm trying to build a forum of my own but
> have stumbled on my first problem as early as the opening page.
>
> To the problem:
> I want to show a simple forum layout with tables looking something like
> this
>
> Forum Name | Topics | Posts | Last Post
> ---------------------------------------------------
> General | 1 | 4 | Webmaster, 09 Feb -06
>
> To do this I use the following SQL;
> sqlPosts = "SELECT Date, COUNT(Date) as NrOfPosts FROM ForumPosts WHERE
> ForumID = " & rsForum("ForumID") & " GROUP BY Date ORDER BY Date DESC"
>
> But this doesnīt give me the right numbers. Instead of showing Topics to
> be 1 and Posts to be 4 it shows Topics to be 1 and Posts to 1.
>
> But if I use a simpler sql, like this;
> sqlPosts = "SELECT COUNT(Date) as NrOfPosts FROM ForumPosts WHERE
> ForumID = " & rsForum("ForumID") & " ORDER BY Date DESC"
>
> Then it works, but I canīt get any other info from the table, like date,
> userid etc.
>
> I use this simple asp to call on the count and the date:
> DatePosted = rsPosts("Date")
> NrOfPosts = rsPosts("NrOfPosts")
>
> What am I doing wrong? is it the asp or the sql?
>
> *** Sent via Developersdex http://www.developersdex.com ***
|