Forum Moderators: coopster

Message Too Old, No Replies

How to count numbers of records from 2 tables

         

chrissim

9:05 am on Aug 22, 2009 (gmt 0)

10+ Year Member



hi,

how do count num of records for two tables? At the moment i able to count for only 1 table.

For eg if i have a total record of 138 in Table A and 150 record in Table B, total for both tables should be 188 records and how do ya count and sum for both tables?

Could someone show me and guide me here as i'm totally lost.

Thanks

andrewsmd

7:19 pm on Aug 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you need to do it in sql syntax or can you use php. If so then just do this
$query = "select count(*) from tableA;"

//do whatever method you are using to connect to the db and read here
//then set a var to the result
$var = //your result here

Then do the same for table b and and add that result to var.

andrewsmd

7:19 pm on Aug 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you paste your table structure I could help you more.