T
Thomas
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?
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?