You may use MERGE TABLES: http://dev.mysql.com/doc/mysql/en/MERGE.html
-- Diana Soares On Tue, 2004-05-04 at 10:08, Ken Gieselman wrote: > Heya folks -- > > Trying to come up with a way to count across multiple tables, and failing > miserably. I need a simple way, preferably better than looped queries, of > summing the number of rows in multiple tables. > > Example: > > I have multiple tables with the same column layout, due to the amount of data > expected to land in each one, broken up by year/month. This is simplified > some, but should serve to illustrate the issue. > > create table info_2004_03 ( > itemID integer auto_increment NOT NULL, > eventID integer NOT NULL, > eventName char(40), > primary key (itemID) > ); > > create table info_2004_04 ( > itemID integer auto_increment NOT NULL, > eventID integer NOT NULL, > eventName char(40), > primary key (itemID) > ); > > I need to get a total number of itemIDs over all the info_ tables. I could just > query each of the tables individually and add the results, but looking for a > more graceful way of doing it, hopefully. > > Thanks in advance! > > ken > =========================================================================== > "Diplomacy is the weapon of the Civilized Warrior" > - Hun, A.T. > > Ken Gieselman [EMAIL PROTECTED] > System Administrator http://www.endlessknot.com/~ken > Endlessknot Communications http://www.endlessknot.com > =========================================================================== -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]