select  *  from table1   where 1=1 order by 日期 desc
union 
select * from table2 where 1=1 order by 日期 desc提示union 附近有语法错误但把两个order by 去掉就 可以了不知大家遇到过这个问题没有?

解决方案 »

  1.   

    想要排序,外面再套一层select * from(
    select  *  from table1   where 1=1 
    union 
    select * from table2 where 1=1)a
    order by 日期 desc
      

  2.   

    select  *  from table1   where 1=1 --order by 日期 desc
    union 
    select * from table2 where 1=1 order by 日期 desc第一个去掉就可以了不过是等于:
    (select  *  from table1   where 1=1 --order by 日期 desc
    union 
    select * from table2 where 1=1 )order by 日期 desc
      

  3.   

    语法上不支持,用UNION连接的多个查询,只能按照一个排序规则进行排序,这个规则只能写在最后一个UNION连接的查询尾部哦