The names of those tables suggest a fairly big problem with your design. Whenever you start putting actual data into the structure of the database, that should be a huge red flag. - In your case, you have "department_N", where N is a number that I'm guessing represents an ID for the department who's data it stores?
Generally you would put that data
into a table, rather than create multiple tables wit the data in the table name. So instead of doing something like this:
-
department_1
-
+----+------------+----------+
-
| id | date | whatever |
-
+----+------------+----------+
-
| 1 | 2013-01-01 | ... |
-
| 2 | 2013-02-01 | ... |
-
| 3 | 2013-03-01 | ... |
-
+----+------------+----------+
-
-
department_2
-
+----+------------+----------+
-
| id | date | whatever |
-
+----+------------+----------+
-
| 1 | 2013-01-01 | ... |
-
| 2 | 2013-02-01 | ... |
-
| 3 | 2013-03-01 | ... |
-
+----+------------+----------+
-
You should be doing this:
-
department
-
+----+------------+----------+--------+
-
| id | date | whatever | number |
-
+----+------------+----------+--------+
-
| 1 | 2013-01-01 | ... | 1 |
-
| 2 | 2013-02-01 | ... | 1 |
-
| 3 | 2013-03-01 | ... | 1 |
-
| 4 | 2013-01-01 | ... | 2 |
-
| 5 | 2013-02-01 | ... | 2 |
-
| 6 | 2013-03-01 | ... | 2 |
-
+----+------------+----------+--------+
-
The number there represents the department number the row belongs to.
This makes the data a LOT easier to work with, and makes it possible to add as many departments as is needed without having to keep creating new tables.