select * from
(select name,time,price,good,null address,null store,null belong,null class,null from,null to from table1
union all
select name,time,null price,null good,address,store,null belong,null class,null from,null to from table2
union all
select name,time,null price,null good,null address,null store,belong,class,null from,null to from table3
union all
select name,time,null price,null good,null address,null store,null belong,null class,from,to from table4)
order by time desc,name

解决方案 »

  1.   

    不行呀
    price 和null price是不同的datatype
    ============================================
    ERROR at line 1:
    ORA-01790: expression must have same datatype as corresponding expression
      

  2.   

    是不是如果是varchar类型的就用null,如果是number类型的就使用0?假如是date类型呢?
      

  3.   

    可以用一个很久的年份来代替 如1900
    to_date('19000101','yyyymmdd')