我用它来获得总计数
$exe = mysql_query('SELECT SUM(field_3) FROM t_a');
$res = mysql_fetch_row($exe);
echo 'Total Count: ' .$res[0] . ' / XX';
但是我需要来自具有相同结构的多个表,名为t_a,t_b,一直到t_z
答案 0 :(得分:0)
您可以在我的sql中使用Union All
select sum(field_3) total
from
(
select field_3
from t_a
union all
select field_3
from t_b
) t
group by field_3