PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 19th, 2004, 11:56 PM
mero mero is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 mero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
combining query results for report

i have to build a report that gives usage information about a forum. like below:
----------------------------
Forum | Posts | Replies
----------------------------
Forum1 | 34 | 35
Forum2 | 11 | 5
etc...

the posts and replies are stored in 2 different tables, so since I use an older version of MySQL, i've been told that i cannot do this with 1 query. So I created 2 queries to give me the data.

1)
PHP Code:
 SELECT f.forum_nameCOUNT(.topic_poster)  AS topics
                 FROM phpbb_forums f
phpbb_topics t
                 WHERE t
.topic_poster $vm_user_id
                 
AND t.forum_id f.forum_id
                 GROUP  BY f
.forum_name
                 ORDER  BY f
.forum_name 


this gives me forum name and topic like so:
----------------------------
Forum | Posts |
----------------------------
Forum1 | 34 |
Forum2 | 11 |
etc...

2)
PHP Code:
 SELECT f.forum_name,COUNT(p.poster_id) AS posts 
                 FROM phpbb_forums f
,phpbb_posts p 
                 WHERE p
.poster_id $vm_user_id 
                 
AND p.forum_id f.forum_id
                 GROUP BY f
.forum_name 
                 ORDER BY f
.forum_name 


this gives me forum name and posts like so:
----------------------------
Forum | | Replies
----------------------------
Forum1 | | 35
Forum2 | | 5
etc...

anyone know how i can combine the results of these 2 queries into the desired report?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > combining query results for report


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT