Browse Source

매장단가관리 쿼리수정

isna 2 years ago
parent
commit
d8a88df83f
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/main/resources/mybatis/sqlmaps/stinfo/StoreItemUnit.xml

+ 7 - 2
src/main/resources/mybatis/sqlmaps/stinfo/StoreItemUnit.xml

@@ -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>