|
@@ -247,8 +247,13 @@
|
247
|
247
|
fn_code_nm('DSTRBT_COST_UNIT','Y') as unit_target_nm,
|
248
|
248
|
item.unit_amt as spply_unit_amt,
|
249
|
249
|
item.brand_unit_unq_no, item.store_sale_unit_amt as unit_amt,
|
250
|
|
- spply_id, fn_spply_nm(spply_id) as spply_nm
|
251
|
|
- from brand_item_unit_info item
|
|
250
|
+ spply_id, fn_spply_nm(spply_id) as spply_nm, spply.spply_amt
|
|
251
|
+ from
|
|
252
|
+ brand_item_unit_info item
|
|
253
|
+ LEFT join (
|
|
254
|
+ SELECT brand_id, item_id, MAX(unit_amt) AS spply_amt
|
|
255
|
+ FROM brand_item_unit_info GROUP BY brand_id, item_id
|
|
256
|
+ ) spply ON item.brand_id = spply.brand_id AND item.ITEM_ID = spply.item_id
|
252
|
257
|
where item.brand_id = #{brandId}
|
253
|
258
|
order by item.item_id, item.unit_amt
|
254
|
259
|
</select>
|