in reply to (OT) MySQL Help

Because MySQL does not support dynamic SQL you have to write perl to wrap the required SQL. The INFORMATION_SCHEMA TABLES Table contains the info you need to generate the SQL.

The initial SQL would look like this :-

SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'db_name'
Or you could use table_info on your database handle if you don't need to limit the returned list of tables or are going to filter it in perl.

The second dynamic SQL statement would look like :-

$sql = join ' UNION ', map "SELECT ID, Name, Class, Mark, $_ table_na +me from $_", @tables;
Hope it help
UnderMine