sql虚拟列+ 多表查询

select car,intime from CarIn;

select car,outtime from Carout;

select car,'出场' as type,outtime from Carout;       //type列不存在

select car,'入场' as type,intime from CarIn;           //type列不存在

多表查询:
select car,type,time from (
select car,'入场' as type,intime as time from CarIn
union all
select car,'出场' as type,outtime as time from Carout
)
--group by car
order by time

 

posted on 2014-05-17 00:27  IOTer  阅读(901)  评论(0编辑  收藏  举报

导航