1 select distinct buyer_nick,receiver_name, ISNULL (receiver_state, '' ) + ' , ' + ISNULL (receiver_city, '' ) + ' , ' + ISNULL (receiver_district, badroom '' ) + ' , ' + ISNULL (receiver_address, '' ) + ' , ' addr, '' ' 1 ' ,receiver_mobile, ' CL60035/1s*1 ' sku, '' post code, ' 满899送60035/1s ' memo, identity ( int , 1 , 1 ) rownumber into #t 2 from orders 3 where 4 (Payment - isnull (post_fee, 0 )) >= 899 and pay_time between ' 2013-01-01 badroom ' and ' 2013-09-14 ' 5 and seller_nick = ' **旗舰店 ' 6 and status not like ' %closed% ' 7 and is_main = 1 8 9 select * from #t where rownumber in ( 10 select MAX(rownumber) rownumber from #t a where a.buyer_nick=#t.buyer_nick group by a.buyer_nick 11 ) 12 drop table #t
公告
No comments:
Post a Comment