Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 15th, 2003, 04:49 AM
Registered User
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to irfan4 Send a message via Yahoo to irfan4
Default Query Wanted.

Hi Guys.

i have three tables

tblGroups [groupid, groupname, description]
tbltopics [topicid, topicname, description]
tblmessage[messageid, topicid, subject, body, date]

As you see i am designing a discussion forum... i want to display just like you see the first screen of p2p forums of this site...

[group name ] [group desc.] [total topics] [total replies]
  group1 this is g1 100 100

i hope u ppl understand...

i want the query...'

Irfan Bashir(pk)

Old July 15th, 2003, 06:49 AM
Registered User
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to MRvLuijpen Send a message via MSN to MRvLuijpen

Hello Irfan,

I hope I understand correctly, and have thought of the following code
 SELECT [tblGroups].[groupname], [tblGroups].[description], Count([tblTopics].[Topicname]) AS [Total Topics], Count([tblMessage].[messageid]) AS [total replies]
FROM tblTopics INNER JOIN (tblGroups INNER JOIN tblMessage ON [tblGroups].[groupid]=[tblMessage].[groupid]) ON [tblTopics].[Topicid]=[tblMessage].[topicid]
GROUP BY [tblGroups].[groupname], [tblGroups].[description];
NB: the tblMessage is extended with the field groupid. perhaps this field has to go into the tbltopic, and then the code would be something like
 SELECT tblGroups.groupname, tblGroups.description, Count(tblTopic2.Topicid) AS [total topics], Count(tblMessage2.messageid) AS [total replies]
FROM (tblGroups INNER JOIN tblTopic2 ON tblGroups.groupid = tblTopic2.GroupId) INNER JOIN tblMessage2 ON tblTopic2.Topicid = tblMessage2.topicid
GROUP BY tblGroups.groupname, tblGroups.description;
Hope this helps


Similar Threads
Thread Thread Starter Forum Replies Last Post
WANTED: Code-behind cookbook! keuler ASP.NET 3.5 Basics 1 April 29th, 2008 03:02 PM
HELP WANTED naana Visual Studio 2005 3 July 26th, 2007 03:45 AM
Struts help wanted Guna JSP Basics 0 December 7th, 2004 11:03 PM
Session Management wanted some help knight Beginning PHP 8 March 12th, 2004 04:07 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.