SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Count help
-
Jan 30, 2005, 17:59 #1
- Join Date
- Aug 2003
- Location
- Southern California, United States
- Posts
- 1,616
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Count help
Hi I am using the following queries
SELECT * FROM $topics_table WHERE board_id = '{$row2['board_id']}'
SELECT * FROM $replies_table WHERE board_id = '{$row2['board_id']}'
then I do the query results and a mysql_num_count for each then I add them to together with a variable. So there is 1 row in topics table and 1 row in the replies table. Is there anyway to combine these queries? ANy way at all, or is it impossible in mysql?Have a good day.
-
Jan 30, 2005, 18:59 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
here ya go --
Code:select one + two as four from ( select count(*) as one from $topics_table WHERE board_id = {$row2['board_id']} ) as five cross join ( select count(*) as two from $replies_table WHERE board_id = {$row2['board_id']} ) as seven
Bookmarks