SQL语句改成这样试试;
select * from table1 where table1.flag = 1 union all select * from table2 where table2.flag = 1 union all select * from table3 where table3.flag =1

解决方案 »

  1.   

    php生成excel文档[虽然没什么功能,但是免费可以交货]<?
    header("Content-type:application/vnd.ms-excel");
    header("Content-Disposition:filename=test.xls");
    echo "test1\t";
    echo "test2\t\n";
    echo "test1\t";
    echo "test2\t\n";
    echo "test1\t";
    echo "test2\t\n";
    echo "test1\t";
    echo "test2\t\n";
    echo "test1\t";
    echo "test2\t\n";
    echo "test1\t";
    echo "test2\t\n";
    ?>
      

  2.   

    不行,好像不能使用union......
      

  3.   

    union 4.0.0开始支持。
    存储过程在4.1开始支持。针对楼主的需求,4.0以上就行了,
    另外,sql语句有问题,注意语法格式,就像数学运算中的括号一样,别忘了:)呵呵