Query or routine contains too many table references Explanation: A query expression, trigger actions, procedures or function definition involves too many tables, views or table expressions in joins and unions. User Action: Rewrite the query to use fewer tables. Creating views to define intermediate unions and joins may solve the problem. For stored routines break the routine into small routines and use the CALL statement to execute parts of the program.