动态数怎么实现?


如图,我有颗料总共有240箱,其中P001上放前1—120箱,P002上放121—240箱
要怎么实现如图所示的箱数的形式呢?
FineReport半面妆 发布于 2017-2-15 15:22
悬赏:2 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共6回答
最佳回答
0
gxy120313发布于2017-2-15 15:22(编辑于 2023-9-6 09:34)
555
最佳回答
0
Poseidon发布于2017-2-15 15:25(编辑于 2023-9-6 09:34)
555
  • 半面妆 半面妆(提问者)

    SELECT
            A.[region]
          , A.[transation_reference]
          , A.POE_COC
          , A.[transport_method]
          , A.[carrier_code]
          , A.[shipment_type]
          , A.[shipment_id]
          , A.[po_no]
          , A.[po_item_no]
          , A.[pn]
          , A.[pn_descriibtion]
          , A.[ship_qty]
          , A.ship_qty_unit
          , A.[HAWB_No]
          , A.[Invoice_no]
              , B.[ship_qty]
          ,B.[ship_date]
          ,B.[transport_method]
          ,B.[destination]
          ,B.[Pallet_qty]
          ,B.[Pallet_no]         / 一个[transation_reference]下有多个栈板号
          ,B.[shipment_ID]
          ,B.original_port
          ,B.[CTN_qty]
              ,C.[Region],
           C.Destination_plant
          ,C.[Consignee_Name_1]
          ,C.[Consignee_Name_2]
          ,C.[Additional_Delivery_To_Name]
          ,C.[Address_1]
          ,C.[Country]
          ,C.[City]
          ,C.[State]
          ,C.[Postal_Code]
          ,C.[telephone]
          ,C.return_name
          ,C.[return_address]
          ,C.[return_postal_code]
        ,sum(cast(B.[CTN_qty] as int)) as total_CTN   /一个reference下的总箱数

    FROM     TMS_response as A
    inner join   
                Ship_Pallet as B  
                            on  A.[transation_reference] =B.transaction_reference
                                              and A.po_no=B.po and A.po_item_no=B.po_item_no
    inner join
                        PO_Detail    as D
                         on  B.po=D.cust_po_no  and  B.po_item_no=D.po_item_no
    inner join   
                [Alice_Test].[dbo].[md.country_info] as C
                            on C.Destination_plant=D.destination_code
    where 1=1
          ${if(len(Reference)==0,\"\",\"and A.[transation_reference]=\'\"+Reference+\"\'\")}
          ${if(len(ShipID)==0,\"\",\"and A.[shipment_id]=\'\"+ShipID+\"\'\")}
          ${if(len(PLno)==0,\"\",\"and B.[Pallet_no] =\'\"+PLno+\"\'\")}
          ${if(len(PO)==0,\"\",\"and  A.[po_no] =\'\"+PO+\"\'\")}
    group by
        A.[region]
          , A.[transation_reference]
          , A.POE_COC
          , A.[transport_method]
          , A.[carrier_code]
          , A.[shipment_type]
          , A.[shipment_id]
          , A.[po_no]
          , A.[po_item_no]
          , A.[pn]
          , A.[pn_descriibtion]
          , A.[ship_qty]
          , A.ship_qty_unit
          , A.[HAWB_No]
          , A.[Invoice_no]
              , B.[ship_qty]
          ,B.[ship_date]
          ,B.[transport_method]
          ,B.[destination]
          ,B.[Pallet_qty]
          ,B.[Pallet_no]
          ,B.[shipment_ID]
          ,B.original_port
          ,B.[CTN_qty]
              ,C.[Region],
           C.Destination_plant
          ,C.[Consignee_Name_1]
          ,C.[Consignee_Name_2]
          ,C.[Additional_Delivery_To_Name]
          ,C.[Address_1]
          ,C.[Country]
          ,C.[City]
          ,C.[State]
          ,C.[Postal_Code]
          ,C.[telephone]
          ,C.return_name
          ,C.[return_address]
          ,C.[return_postal_code]
    order by B.[Pallet_no] asc
    回复
    2017-02-15 15:42 
最佳回答
0
半面妆发布于2017-2-15 15:42(编辑于 2023-9-6 09:34)
555
  • Poseidon Poseidon

    数据集结果,我看SQL我知道个啥啊。。。
    回复
    2017-02-15 15:44 
最佳回答
0
Poseidon发布于2017-2-15 15:44(编辑于 2023-9-6 09:34)
555
最佳回答
0
gxy120313发布于2017-2-15 16:05(编辑于 2023-9-6 09:34)
555
最佳回答
0
半面妆发布于2017-2-15 16:26(编辑于 2023-9-6 09:34)
555
  • gxy120313 gxy120313

    先把数据进行分割,然后把分割后的数据放在单元格中进行隐藏,然后把总数的字段也拖拽到单元格进行隐藏
    使用CONCATENATE()函数进行拼接单元格就可以了
    回复
    2017-02-15 15:22 
  • 0关注人数
  • 508浏览人数
  • 最后回答于:2017-2-15 16:26
    活动推荐 更多
    热门课程 更多
    返回顶部