BEGIN SET @sql = CONCAT(" select * from table1 where " , DATERAW , " UNION select * from table2 where " , DATERAW , " UNION select * from