If you know the primary keys of the two tables, it may be done as follows: select count(distinct t1.pk1) + count(distinct t2.pk2) from t1,t2; where - pk1 is the primary key column name of table t1 and pk2 is the primary key column name of table t2.
SB ----- Original Message ----- From: "Rick Baranowski" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 13, 2002 8:39 AM Subject: Re: Count Rows in two tables > Please forgive me I am new to mySQL, could you give me an example of how I > would do this? The two tables are users and staff > > Thanks > Rick > > > ----- Original Message ----- > From: "Murad Nayal" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, November 12, 2002 6:58 PM > Subject: Re: Count Rows in two tables > > > > > > Alan McDonald wrote: > > > > > > You can't count the join? > > > Alan > > > > if you count the (unqualified) join you'll end up with the product of > > the two table counts. > > > > Murad > > > > > > > > > -----Original Message----- > > > > From: Rick Baranowski [mailto:rickb@;baranconsulting.com] > > > > Sent: Wednesday, 13 November 2002 12:10 > > > > To: [EMAIL PROTECTED] > > > > Subject: Count Rows in two tables > > > > > > > > > > > > Hello all, > > > > > > > > Does anybody have a SQL string to count the rows in two different > > > > tables and > > > > give you a total number of rows? I have been trying to find an > > > > answer for a > > > > couple of days and seems like a simple string. > > > > > > > > Thank you > > > > > > > > Rick > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php