代码改变世界

Union all 分别排序

2011-11-01 20:05  鹏雕  阅读(914)  评论(0编辑  收藏  举报

 

Create PROCEDURE [dbo].[JiuChanPinLiuTongJiLuProcess]
(
    @JiuChanPinId decimal(18,0)
)
AS
select * from (
select top 100 Percent UpdateDate 日期,''+ShouHuoName +''+ GouHuoName as 流通方式
                                  from VWJiuChanPinLiuTongJiLu where BCLiuTongLeiXingId=1 andJiuChanPinId=@JiuChanPinId order by UpdateDate)m
union  all
select * from (
select  top 100 Percent UpdateDate 日期,''+ShouHuoName+'' + GouHuoName  as 流通方式    from VWJiuChanPinLiuTongJiLu where BCLiuTongLeiXingId=2 andJiuChanPinId=@JiuChanPinId  order by UpdateDate)n
go