我认为最好写一个函数还进行处理比较方便些。

解决方案 »

  1.   

    建立临时表?还有你来错地方了。      
          sql="select product_type,count(tablelast.product_type) as total_table "
          sql=sql&"from ("
          sql=sql&"Select product_type,payment_time,flag from asiapastjp union all "
          sql=sql&"Select product_type,payment_time,flag from drpartsjp union all "
          sql=sql&"Select product_type,payment_time,flag from hip_watchjp union all "
          sql=sql&"Select product_type,payment_time,flag from my_watchjp union all "
          sql=sql&"Select product_type,payment_time,flag from optionpartsjp union all " 
          sql=sql&"Select product_type,payment_time,flag from sunbobojp union all " 
          sql=sql&"Select product_type,payment_time,flag from tibeteyehkjp union all "
          sql=sql&"Select product_type,payment_time,flag from 123_toy_eng union all "
          sql=sql&"Select product_type,payment_time,flag from drparts_eng union all "
          sql=sql&"Select product_type,payment_time,flag from eonon_eng union all "
          sql=sql&"Select product_type,payment_time,flag from hip_watch_eng union all "
          sql=sql&"Select product_type,payment_time,flag from my_watch_eng union all "
          sql=sql&"Select product_type,payment_time,flag from resthouse_eng union all "
          sql=sql&"Select product_type,payment_time,flag from sbbpow_eng union all "
          sql=sql&"Select product_type,payment_time,flag from optionparts_eng"
          sql=sql&") as tablelast