悟生慧

 

两张表合并加标识根据ID

select fpt_point,dt,(case [type] when 1 then '充值' when 0 then '消费' else 'error' end)as [type] from
(select fpd.fpt_point,fpd.dt,'1' as [type] from td_fullPointDetail fpd  where fpd.mem_id=1
union
select cpd.cpd_point,cpd.dt,'0' as [type] from td_consumePointDetail cpd where cpd.mem_id=1)as a

posted on 2010-08-27 16:37  悟生慧  阅读(297)  评论(0编辑  收藏  举报

导航