Change is constant - 变化时唯一的永恒

建立临时的表 数据 空值 与 NULL 转换

if exists ( select * from INFORMATION_SCHEMA.tables
where table_name = 'Config_Order_ChargesToPreView')
drop table Config_Order_ChargesToPreView
select * into Config_Order_ChargesToPreView from Config_Order_Charges

 

 

 

select HMNUM
, case when ISNULL(SubHMNUM, '') = '' then HMNUM else SubHMNUM end as SubHMNUM
, pc.ParcelSize
into #pc
from ProductCartons pc inner join (
select MAX(ProductCartonsID) as id
from ProductCartons
group by HMNUM, case when ISNULL(SubHMNUM, '') = '' then HMNUM else SubHMNUM end
) b on pc.ProductCartonsID = b.id

posted @ 2016-04-13 17:45  人海灬  阅读(253)  评论(0编辑  收藏  举报